I'm with some really strange trouble with my android click listener button! I've already done that several times, I'm getting crazy not founding an solution (neither an logical explanation) for this error.
error The event handler for 2 buttons on my activity are not being executed. There is no error, it just not performance the handler action at runtime. This is the code for one of the buttons:
btnNext = (Button) findViewById(R.listclient.btnnext);
btnNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Toast.makeText(MyActivityClassName.this, "Flag 01", 1).show();
btnNext.setText("CLICKED!");
}
});
And that's the button on xml layout:
<Button android:id="@+listclient/btnnext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
style="@style/Widget.TextViewInfo"
android:text="Next"
/>
info
- There is also an ImageButton inside this activity, this imageButton works perfectly with an inner OnClickListener class (just like this one).
- I have already tried to make my activity class inherit OnClickListener and set it as the click listener for the button with no success.
- I have also created an class inside my Activity class, and set it as the button click listener, no success too.
I'm compiling for Android 2.1 + Google API (SDK 7)
------------EDITED-----------------
If I put in my code:
btnNext.performClick();
It's executed! I'm getting even crazy right now! And the button is in fact clicked when I touch it, I can see the button "animation", and the click is logged in LogCat.