I\'m using an extended version of BaseAdapter based on the EfficientAdapter example from the SDK demo samples.
My data is basically an object (ListPlaces
Thanks to the hint with getViewTypeCount() and getItemViewType() it works perfectly now.
Implementing these two methods was very simple:
@Override
public int getViewTypeCount() {
return 2;
}
@Override
public int getItemViewType(int position) {
if(listPlaces.getValues().get(position).separator >= 0)
return 0;
else
return 1;
}
As commonsware mentioned in his answer this way Android will maintain different object pools for different list items, which also means you can remove the check for listRow_previous in my example and change the if (convertView == null || (listRow != listRow_previous)) to if (convertView == null) only.