Reputation: 6912
I use Fedor's lazy load for gallery show several pictures with URL. The code
class BitmapDisplayer implements Runnable {
Bitmap bitmap;
PhotoToLoad photoToLoad;
public BitmapDisplayer(Bitmap b, PhotoToLoad p) {
bitmap = b;
photoToLoad = p;
}
public void run() {
if (imageViewReused(photoToLoad)) {
System.out.println("imageViewReused");
return;
}
// exist in memory cache or SD cache
if (bitmap != null) {
photoToLoad.imageView.setImageBitmap(bitmap);
}
// cache not exist and loading
else {
photoToLoad.imageView.setImageResource(R.drawable.load);
photoToLoad.imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
}
}
}
It check the cache weather exist. If not, means loading not finish and show R.drawable.load. But while the picture loading finish, the imageView does not update the image, and still show the drawable. How should I modify to update while loading finish?
Upvotes: 1
Views: 202
Reputation: 9258
You probably need to call notifyDataSetChanged()
after setting bitmap in case you are using BaseAdapter
or its child in your gallery.
Upvotes: 2