-
Notifications
You must be signed in to change notification settings - Fork 24
@OnItemClick
dexafree edited this page Aug 21, 2014
·
3 revisions
This annotation will trigger an event when an AbsListView (ListView, GridView...) item is clicked.
The method should be this way (the method and variable names can be changed):
- public void onItemClick(int position)
- public void onItemClick(int position, AdapterView adapterView)
- public void onItemClick(int position, AdapterView adapterView, View clickedView)
@OnItemClick(R.id.list)
public void onItemClick(int position) {
Toast.makeText(this, "Item $position clicked", Toast.LENGTH_SHORT).show();
}