I have a ListView
that uses a subclass of BaseAdapter
. The adapter uses item indices (positions) as ids and thus the ids are not stable (one of the operations on the underlying data is swapping between two data items).
Do I need to override in my adapter hasStableIds()
to return false
?
Looking at the BaseAdapter
here suggest
that false is the default
.
http://www.netmite.com/android/mydroid/frameworks/base/core/java/android/widget/BaseAdapter.java
// Is this required? Isn't this the default?
@Override
public final boolean hasStableIds() {
return false;
}
@Override
public final long getItemId(int position) {
return position;
}
No you do not need to override hasStableIds()
if you want the default behavior because its a method of Adapter interface which the BaseAdapter implements through ListAdapter and SpinnerAdapter and therefore has to provide a default implementation of that.
However you do need to override getItemId(int position)
because its an abstract method of BaseAdapter class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With