Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It looks like you were trying to implement a <code>ViewHolder</code> to save the extra <code>findViewById</code> calls when using recycled views. The problem is that you're storing those views per-adapter instead of per-recycled view. You need to create a separate <code>ViewHolder</code> object and store it along with each view. The view's tag is a good place to do this.</p> <p>Try this:</p> <pre><code>public class CustomListViewAdapter extends BaseAdapter { private static ArrayList&lt;Show&gt; mSearchArrayList; private LayoutInflater mInflater; public CustomListViewAdapter(Context context, ArrayList&lt;Show&gt; results) { mSearchArrayList = results; mInflater = LayoutInflater.from(context); } public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { convertView = mInflater.inflate(R.layout.custom_row, null); holder = new ViewHolder(); holder.title = (TextView) convertView.findViewById(R.id.title); holder.prev = (TextView) convertView.findViewById(R.id.prevNrDate); holder.next = (TextView) convertView.findViewById(R.id.nextNrDate); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } final Show item = mSearchArrayList.get(position); holder.title.setText(item.getTitle()); holder.prev.setText(item.getPrevNr() + " - " + item.getPrevDate() + "\n" + item.getPrevTitle()); holder.next.setText(item.getNextNr() + " - " + item.getNextDate() + "\n" + item.getNextTitle()); return convertView; } private static class ViewHolder { public TextView title; public TextView prev; public TextView next; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload