I initialised a button with
Button button1 = null;
in the beginning of my activity. After the layout is set, I do
final Button button1 = (Button) findViewById(R.id.button1);
button1.setOnClickListener(this);
The onClick looks like that
public void onClick(View v) {
if(v == button1) {System.out.println("asd");};
System.out.println(v);
}
The print shows "I/System.out(22758): android.widget.Button@**405632f0**"
and of course, the println("asd") doesn't show up.
I don't want to get the Button@** code for every single button because working with the id of course is much easier.
Someone has in Idea what I did wrong?