Categories
discuss

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 …

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

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.

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..