This is a nice hack when developing apps in Android (similar to JavaFX) - define the on click events in XML:
1 |
<Button .... android:onClick="clicked" /> |
In the Activity
, we can specify the method:
1 2 3 |
public void clicked(View view) { /// this will get triggered } |
This is much cleaner than:
1 |
button.setOnClickListener(...); |