I implemented lazy images in my ListView . I use AsyncTask to download an image from the Internet and bind it to ImageView in UIThread.
It works, except that when scrolling through the ListView change quickly, uploaded images are sometimes snapped to the wrong elements in the list.
I think the problem is the reuse of convertView in the BaseAdapter . Any ideas to solve it?
Many thanks.
EDIT: I am posting the response as follows:
public void setBitmap(int position, Bitmap image) { View itemView = mListView.getChildAt(position - mListView.getFirstVisiblePosition()); if (itemView != null) { ImageView itemImageView = (ImageView) itemView.findViewById(R.id.item_imageview); itemImageView.setImageBitmap(image); } }
android android-listview lazy-loading
shiami
source share