My question is purely general. Why does Java force you to write complicated handlers that need to be attached to objects for a simple thing like a click?
So, why do I need to write:
public class ClickMe implements OnClickListener {
void someMethod() {
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(this);
}
@Override
public void onClick(View v) {
....
}
}
instead of something like
class myButton extends Button {
@override void onClick() {
// do something special
}
and then use that button on my layout?
I'm sure there are good reasons for this design, I just can't think of them!