I have a button like this:
<Button
android:id="@+id/logout_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Log out"
/>
and I have a listener like this:
Button logout = (Button)findViewById(R.id.logout_button);
logout.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View v)
{
Toast.makeText(getApplicationContext(), "Logging out. Please wait...", Toast.LENGTH_LONG).show();
sendEmail("Logout Chosen", "From home page, user clicked on logout" );
Intent myIntent = new Intent(ProblemioActivity.this, LogoutActivity.class);
ProblemioActivity.this.startActivity(myIntent);
}
});
I don’t remember making too many changes to this, but the button suddenly stopped responding to clicks. Funny thing is on the same page the other buttons all work well still.
Any idea why this might happen?
Thanks!
1)Try rebuilding your code and see if that works.
ECLIPSE: Project>Clean>Your Project
2) Also, check the other button’s ID’s, and make sure you did not accidentally named them the same (there should only be one button whose ID is “logout_button”)