Raja
Raja

Reputation: 6824

AdapterView.OnItemClickListener

In methods like these kind,

onItemClick(AdapterView<?> parent, View view, int position, long id),

what's the difference between position and id.

Upvotes: 0

Views: 1358

Answers (2)

Anthony Forloney
Anthony Forloney

Reputation: 91786

position is the position of the view in the adapter, while id is the row id of the item selected.

Upvotes: 0

David Hedlund
David Hedlund

Reputation: 129792

Well, the id is, as the name suggests, an identifier, that you can use to identify that specific item in the adapter. Position refers to the index of the item, in the adapter.

Upvotes: 3

Related Questions