-
Notifications
You must be signed in to change notification settings - Fork 24
@OnItemLongClick
Jon edited this page Jun 8, 2015
·
3 revisions
This annotation will trigger an event when an AbsListView (ListView, GridView...) item is long-clicked.
The method should be this way (the method and variable names can be changed):
- public boolean onItemClick(int position)
- public boolean onItemClick(int position, AdapterView adapterView)
- public boolean onItemClick(int position, AdapterView adapterView, View clickedView)
Notice it must return a boolean
@OnItemLongClick(R.id.list)
public boolean onItemLongClick(int position) {
Toast.makeText(this, "Item $position long-clicked", Toast.LENGTH_SHORT).show()
return true
}