Note that there are some explanatory texts on larger screens.

plurals
  1. POImages were Shuffled when scrolling a ListView with a ViewHolder
    primarykey
    data
    text
    <p>My problem is connected when the user scrolls the ListView. I looked around and saw numerous examples of 'listview lazy image', has also watched the video of the Google IO which speaks of 'good practice ' to make this work. But my problem continues when the user moves up and down the ListView.</p> <p>What happens is that when scrolling the list, the images that were loaded on each item are shuffled, and the avatar of each item going to the next item ends. I do not know if I'm being clear but I will show with the image.</p> <p>When you start, items that have no image left with the standard image.</p> <p>Image 1: <a href="http://boxandroid.com/app/weguide/itsok.png" rel="noreferrer">http://boxandroid.com/app/weguide/itsok.png</a> Before user scroll ListView: <a href="http://boxandroid.com/app/weguide/nook.png" rel="noreferrer">http://boxandroid.com/app/weguide/nook.png</a></p> <p>Note that the pictures were shuffled among other items.</p> <p>in my adapter:</p> <pre><code>public View getView(int position, View convertView, ViewGroup parent){ ViewHolder viewHolder = new ViewHolder(); if(convertView == null){ convertView = _inflate.inflate(R.layout.layout_list, null); viewHolder.text = (TextView) convertView.findViewById(R.id.title); viewHolder.owner = (TextView) convertView.findViewById(R.id.owner); viewHolder.image = (ImageView) convertView.findViewById(R.id.thumb); convertView.setTag(viewHolder); }else{ viewHolder = (ViewHolder) convertView.getTag(); } HashMap&lt;String, String&gt; item = (HashMap&lt;String, String&gt;) getItem(position); viewHolder.text.setText( item.get("poiName").toString() ); viewHolder.owner.setText( item.get("owner").toString() ); ImageView imageView = viewHolder.image; imageView.setTag(item.get("thumbs")); if(!item.get("thumbs").equals("null")){ Drawable cacheImage = loader.loadDrawable(item.get("thumbs"), new ImageManage.ImageCallback() { public void imageLoaded(Drawable imageDrawable, String imageUrl) { ImageView imageViewByTag = (ImageView) _listView.findViewWithTag(imageUrl); if(imageViewByTag != null) imageViewByTag.setBackgroundDrawable(imageDrawable); } }); imageView.setImageDrawable(cacheImage); notifyDataSetChanged(); } return convertView; } </code></pre>
    singulars
    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.
 

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