Skip to content
dexafree edited this page Aug 21, 2014 · 3 revisions

This annotation will trigger an event when a CompoundButton (for example, a RadioButton) is checked.

How to use

The method should be this way:

  • public boolean onChecked(boolean checked)
  • public boolean onChecked(CompoundButton button, boolean checked)

Example

@OnChecked(R.id.radio_button)
public public boolean onChecked(CompoundButton button, boolean checked) {
    Toast.makeText(this, "Button checked: $checked", Toast.LENGTH_SHORT).show();
    return false;
}