//Login activity
package com.example.vidhit.evoletandroid;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.vidhit.evoletandroid.R;
public class Login extends AppCompatActivity {
private EditText myemailEDT, myPasswordEDT;
private Button mySigninBT,mySignUpBt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
try {
getSupportActionBar().hide();
}
catch(Exception e)
{
System.out.println("exception ");
}
intialization();
}
private void intialization() {
myemailEDT = (EditText) findViewById(R.id.activity_main_email_edt);
myPasswordEDT = (EditText) findViewById(R.id.activity_main_pwd_edt);
mySigninBT = (Button) findViewById(R.id.actvity_main_Signin_btn);
mySignUpBt=(Button)findViewById(R.id.button);
clickListener();
}
private void clickListener() {
/*
Toast.makeText(getApplicationContext(), "Hello", Toast.LENGTH_SHORT).show();
String aPwdSTR = myPasswordEDT.getText().toString();
if (!aPwdSTR.equals(""))
{
Toast.makeText(getApplicationContext(), aPwdSTR, Toast.LENGTH_SHORT).show();
}
Intent aIntent = new Intent(getApplicationContext(), SecondActivity.class);
Bundle aBundle = new Bundle();
aBundle.putString("KEY", "VALUE");
aIntent.putExtra("KEY", "Email");
aIntent.putExtra("KEY1", "PWD");
startActivity(aIntent);
*/
mySigninBT.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String user = myemailEDT.getText().toString();
String pwd = myPasswordEDT.getText().toString();
if (user.equals("")) {
//System.out.println("Please enter username");
Toast.makeText(Login.this, "Please enter username", Toast.LENGTH_SHORT).show();
}
else if (pwd.equals("")) {
//System.out.println("Please enter password");
Toast.makeText(Login.this, "Please enter password", Toast.LENGTH_SHORT).show();
}
else
{
Intent aIntent = new Intent(Login.this, SecondActivity.class);
aIntent.putExtra("KEY1", user);
aIntent.putExtra("KEY2", pwd);
startActivity(aIntent);
}
}
});
mySignUpBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String user = myemailEDT.getText().toString();
String pwd = myPasswordEDT.getText().toString();
if (user.equals("")) {
//System.out.println("Please enter username");
Toast.makeText(Login.this, "Please enter username", Toast.LENGTH_SHORT).show();
}
else if (pwd.equals("")) {
//System.out.println("Please enter password");
Toast.makeText(Login.this, "Please enter password", Toast.LENGTH_SHORT).show();
}
else
{
Intent aIntents = new Intent(Login.this, Sign_Up.class);
startActivity(aIntents);
}
}
});
}
}
//Below is the Sign_Up activity
package com.example.vidhit.evoletandroid;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
public class Sign_Up extends AppCompatActivity {
private EditText myusr,mypwd,myemail,mycntno,mygender,myhobbies;
private TextView male,female;
private RadioButton m,f;
private CheckBox showpwd;
private Button next;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
try {
getSupportActionBar().hide();
}
catch(Exception e) {
System.out.println("exception ");
}
intialization();
}
private void intialization() {
myusr = (EditText) findViewById(R.id.Username);
mypwd = (EditText) findViewById(R.id.Pwd);
myemail = (EditText) findViewById(R.id.Email);
mycntno = (EditText) findViewById(R.id.Cntno);
mygender = (EditText) findViewById(R.id.Gender);
myhobbies = (EditText) findViewById(R.id.Hobbies);
male = (TextView) findViewById(R.id.Male);
female = (TextView) findViewById(R.id.Female);
m=(RadioButton) findViewById(R.id.rad_m);
f=(RadioButton) findViewById(R.id.radioButton2);
next=(Button)findViewById(R.id.Next);
clickListener();
onRadioButtonClicked();
Intent aintent = getIntent();
String value = aintent.getStringExtra("key");
}
private void onRadioButtonClicked() {
m.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
boolean checked = ((RadioButton) view).isChecked();
switch(view.getId())
{
case R.id.rad_m:
if(checked)
break;//male
case R.id.radioButton2:
if(checked)
break;//female
}
}
});
}
private void clickListener() {
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String user1 = myusr.getText().toString();
String pwd1 = mypwd.getText().toString();
String email=myemail.getText().toString();
String contact=mycntno.getText().toString();
if (user1.equals("")) {
//System.out.println("Please enter username");
Toast.makeText(Sign_Up.this, "Please enter username", Toast.LENGTH_SHORT).show();
}
else if (pwd1.equals("")) {
//System.out.println("Please enter password");
Toast.makeText(Sign_Up.this, "Please enter password", Toast.LENGTH_SHORT).show();
}
else if (email.equals("")) {
//System.out.println("Please enter password");
Toast.makeText(Sign_Up.this, "Please enter password", Toast.LENGTH_SHORT).show();
}
else if (contact.equals("")) {
//System.out.println("Please enter password");
Toast.makeText(Sign_Up.this, "Please enter password", Toast.LENGTH_SHORT).show();
}
else
{
Intent aIntent = new Intent(Sign_Up.this, successregister.class);
aIntent.putExtra("KEY1", user1);
aIntent.putExtra("KEY2", pwd1);
startActivity(aIntent);
}
}
});
}
}
Logcat:
02-08 17:40:57.682 5226-5226/? I/zygote: Not late-enabling -Xcheck:jni (already on)
02-08 17:40:57.729 5226-5226/? W/zygote: Unexpected CPU variant for X86 using defaults: x86
02-08 17:40:57.978 5226-5226/com.example.vidhit.evoletandroid I/InstantRun: starting instant run server: is main process
02-08 17:40:58.202 5226-5258/com.example.vidhit.evoletandroid D/OpenGLRenderer: HWUI GL Pipeline
02-08 17:40:58.336 5226-5258/com.example.vidhit.evoletandroid I/zygote: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-08 17:40:58.336 5226-5258/com.example.vidhit.evoletandroid I/OpenGLRenderer: Initialized EGL, version 1.4
02-08 17:40:58.336 5226-5258/com.example.vidhit.evoletandroid D/OpenGLRenderer: Swap behavior 1
02-08 17:40:58.339 5226-5258/com.example.vidhit.evoletandroid D/EGL_emulation: eglCreateContext: 0xa46840c0: maj 2 min 0 rcv 2
02-08 17:40:58.349 5226-5258/com.example.vidhit.evoletandroid D/EGL_emulation: eglMakeCurrent: 0xa46840c0: ver 2 0 (tinfo 0xa46832d0)
02-08 17:40:58.386 5226-5258/com.example.vidhit.evoletandroid D/EGL_emulation: eglMakeCurrent: 0xa46840c0: ver 2 0 (tinfo 0xa46832d0)
02-08 17:41:01.389 5226-5258/com.example.vidhit.evoletandroid D/EGL_emulation: eglMakeCurrent: 0xa46840c0: ver 2 0 (tinfo 0xa46832d0)
02-08 17:41:01.875 5226-5226/com.example.vidhit.evoletandroid V/View: dispatchProvideAutofillStructure(): not laid out, ignoring 2 children of 1073741832
02-08 17:41:01.877 5226-5226/com.example.vidhit.evoletandroid I/AssistStructure: Flattened final assist data: 2976 bytes, containing 1 windows, 10 views
02-08 17:41:06.665 5226-5241/com.example.vidhit.evoletandroid I/zygote: Do partial code cache collection, code=29KB, data=28KB
02-08 17:41:06.665 5226-5241/com.example.vidhit.evoletandroid I/zygote: After code cache collection, code=29KB, data=28KB
02-08 17:41:06.665 5226-5241/com.example.vidhit.evoletandroid I/zygote: Increasing code cache capacity to 128KB
02-08 17:41:08.646 5226-5226/com.example.vidhit.evoletandroid D/AndroidRuntime: Shutting down VM
02-08 17:41:08.649 5226-5226/com.example.vidhit.evoletandroid E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.vidhit.evoletandroid, PID: 5226
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.vidhit.evoletandroid/com.example.vidhit.evoletandroid.Sign_Up}: android.view.InflateException: Binary XML file line #0: Can't convert value at index 3 to dimension: type=0x12
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #0: Can't convert value at index 3 to dimension: type=0x12
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 3 to dimension: type=0x12
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:730)
at android.view.ViewGroup$MarginLayoutParams.(ViewGroup.java:7767)
at android.widget.RelativeLayout$LayoutParams.(RelativeLayout.java:1269)
at android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:1090)
at android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:1088)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.vidhit.evoletandroid.Sign_Up.onCreate(Sign_Up.java:25)
at android.app.Activity.performCreate(Activity.java:6999)
at android.app.Activity.performCreate(Activity.java:6990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
02-08 17:41:08.819 5226-5241/com.example.vidhit.evoletandroid I/zygote: Do partial code cache collection, code=45KB, data=50KB
02-08 17:41:08.820 5226-5241/com.example.vidhit.evoletandroid I/zygote: After code cache collection, code=45KB, data=50KB
02-08 17:41:08.820 5226-5241/com.example.vidhit.evoletandroid I/zygote: Increasing code cache capacity to 256KB
02-08 17:41:08.828 5226-5241/com.example.vidhit.evoletandroid I/zygote: JIT allocated 71KB for compiled code of void android.widget.TextView.(android.content.Context, android.util.AttributeSet, int, int)
02-08 17:41:08.828 5226-5241/com.example.vidhit.evoletandroid I/zygote: Compiler allocated 4MB to compile void android.widget.TextView.(android.content.Context, android.util.AttributeSet, int, int)
Manifest file:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".Splashscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Login" />
<activity android:name=".SecondActivity" />
<activity android:name=".Sign_Up" />
<activity android:name=".successregister"></activity>
</application>
Question:
When i enter my email and password and click on the signup button my app crashes .Sign in button is working perfectly fine only the sign up button is the main problem.Can anyone help me in resolving this error?.