I'm using UIL with this config to load image from FILEs:
BitmapDisplayer displayer = new FadeInBitmapDisplayer(500) {
@Override
public Bitmap display(Bitmap bitmap, ImageView imageView,
LoadedFrom loadedFrom) {
if (loadedFrom != LoadedFrom.MEMORY_CACHE) {
return super.display(bitmap, imageView, loadedFrom);
} else {
imageView.setImageBitmap(bitmap);
return bitmap;
}
}
};
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheInMemory(true).resetViewBeforeLoading(true)
.showImageForEmptyUri(R.drawable.thumbnail_no_image)
.showImageOnFail(R.drawable.thumbnail_no_image)
.displayer(displayer).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context).defaultDisplayImageOptions(options)
.memoryCacheSize(2 * 1024 * 1024).build();
sLoader.init(config);
I need to implement selection in GridView
so after I consider any item selected I call notifyDataSetChanged
to make my selectionOverlay visible. And after this call all images start reloading nd this causes GridView
to blink. How can I avoid this?
I don't think that you should call notifyDataSetChanged in this situation.
Calling notifyDataSetChanged on adapter tells ListView / GridView that your data is changed you should refresh your self. So when you call this method it reload itself and getView() of adapter is called. This is why UIL starts loading images. (Actually all view of row reloads) because this is written in getView().
For accessing row view and it's data you can use setOnItemClickListener of your GridView. You will get sufficient parameters in this method and so you can work with it accordingly.
I hope this helps. Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With