I'm using a mixture of the "Efficient Adapter" and the EndlessAdapter from CommonsGuy, and sometime the holder in getView() is null.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = inflater.inflate(R.layout.queue_item, null);
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.queueItemText);
holder.image = (ImageView) convertView.findViewById(R.id.queueItemImage);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
if (holder != null) {
holder.text.setText(queueItems.get(position).getTitle().getName());
} else {
Log.e(context.getString(R.string.app_name), "holder is null for some reason ...");
}
return convertView;
}
I've put the rest of the code for both of my classes here, as it's rather large to paste inline.
Once the whole data set is loaded, scrolling up & down causes rows to disappear and re-appear too.