Friday, October 21, 2011

[android-developers] setOnClickListener Problems Crashing Application

I have an application that once a user enters a username and password,
they press a button which authenticates them with the system.
I have used buttons before without problem... But for some reason i am
now getting problems... I have this code in for a while and it has
been working no problem.. but just now it began causing the program to
crash... I did not change anything, and any help is greatly
appreciated..

login_btn_submit = (Button) findViewById(R.id.login_btn_submit);
login_txt_username = (EditText) findViewById(R.id.login_txt_username);
login_txt_password = (EditText) findViewById(R.id.login_txt_password);
login_btn_submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {


if(isUser(login_txt_username.getText().toString(),login_txt_password.getText().toString()))
{
Toast.makeText(getApplicationContext(), "User is User",
Toast.LENGTH_SHORT).show();

Settings_Edit.putString("Username",login_txt_username.getText().toString());

Settings_Edit.putString("Password",login_txt_password.getText().toString());
Settings_Edit.commit();
setInterface("main");
}else{
Toast.makeText(getApplicationContext(), "User is NOT User",
Toast.LENGTH_SHORT).show();
}
}
});

when i remove that section of code, the program functions properly (no
button) but with the code existing, it just crashes ever time.

The code was working fine in an emulator, as soon as i tried to deploy
it to my phone it began erroring on bot, with no change to the code...
Any and all help is greatly appreciated...
~tinyClark

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment