You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 8, 2025. It is now read-only.
Steven Lewi edited this page Jul 13, 2015
·
5 revisions
You can tag any method in your class as an event listener using annotation. Some of the annotations require the method to have mandatory parameters. This is the list of supported event.
@OnFocusChange(R.id.edit_text1)
publicvoideditText1FocusChanged(booleanhasFocus) {
// Method that tagged using @OnFocusChange needs to have 1 boolean parameter.
}
@OnTouch : Used in any kind of View
@OnTouch(R.id.view1)
publicvoidonViewTouched(MotionEventevent) {
// Method that tagged using @OnTouch needs to have 1 MotionEvent parameter.
}
@OnItemClick : Used in AdapterView (ListView, GridView, etc)
@OnItemClick(R.id.list_view1)
publicvoidlistViewItemClicked(intposition) {
// Method that tagged using @OnItemClick needs to have 1 int parameter.
}
@OnItemLongClick : Used in AdapterView (ListView, GridView, etc)
@OnItemLongClick(R.id.list_view1)
publicvoidlistViewItemLongClicked(intposition) {
// Method that tagged using @OnItemLongClick needs to have 1 int parameter.
}
@OnItemSelected: Commonly used in Spinner
@OnItemSelected(R.id.spinner1)
publicvoidspinner1ItemSelected(intposition) {
// Method that tagged using @OnItemSelected needs to have 1 int parameter.
}
@OnCheckedChanged: Commonly used in CompoundButton (CheckBox, RadioButton, Toggle, etc)
@OnCheckedChanged(R.id.checkbox1)
publicvoidcheckBox1CheckedChanged(booleanchecked) {
// Method that tagged using @OnCheckedChanged needs to have 1 boolean parameter.
}