Alvin Then Alvin Then - 1 year ago 57
Android Question

Difference between RowId and Position in onItemLongClick's parameter

I've got confuse on the 3rd and 4th parameter of onItemLongClick(...).
According to AdapterView.OnItemLongClickListener

position - The position of the view in the list

id - The row id of the item that was clicked

I couldn't make any sense out from these, advice please.

Answer Source

position is the clicked element's position in your Adapter (so you can do adapter.getItem(position) )

row id is the id that corresponds to that element, what your Adapter returns in the getItemId() method.