Question

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.

Was it helpful?

Solution

Make sure you are using the latest EndlessAdapter, as it was updated a few weeks ago as I recall.

If that does not help, and if you can give me a full project (not just a couple of classes) that replicates the problem, I can try to fix it. Please contact me via the cw-android Google Group, which is the primary home for support for EndlessAdapter and my other components.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top