I'm implementing a custom ArrayAdapter<T>
, and I want to set the hasStableIds
to true. But the ids of my T items are Strings and the getItemId
method returns longs.
So, what I am currently doing is:
@Override
public boolean hasStableIds() {
return true;
}
@Override
public long getItemId(int position) {
return this.getItem(position).getId().hashCode();
}
Where getId()
returns a String.
Is this the correct solution for using String ids?
In particular, for this case, the String Ids are GUIDs, is there a better option?