(Not specific to ListView, but to Adapter).
I keep implementing this when I subclass BaseAdapter:
@Override
public long getItemId(int positio
There are probably many reasons to have stable item IDs. A default implementation cannot be given since it depends on the type of Object being stored in the Adapter.
Android has a check to make sure that item IDs are used only when they are stabled, i.e. the subclass has properly overridden getItemId; BaseAdapter.hasStableIds must be overriden to return true.
Few reasons I have come across:
AdapterView.OnItemClickListener's method onItemClick(AdapterView> parent, View view, int position, long id) also sends long id
the getCheckedItemIds method The result is only valid if the choice mode has not been set to CHOICE_MODE_NONE and the adapter has stable IDs.
Reply to "Because have to implement that": you don't have to If you don't use the features, there's no need. But if you do, don't forget to override boolean hasStableIds() as well.