Android-Universal-Image-Loader icon indicating copy to clipboard operation
Android-Universal-Image-Loader copied to clipboard

when call notifydatasetchanged() image view refresh

Open ansuangry opened this issue 13 years ago • 11 comments

when call notifydatasetchange() image view refresh reload all the images in Android Grid View

ansuangry avatar Sep 07 '13 10:09 ansuangry

I get the same problem when config DisplayImageOption with .displayer(new FadeInBitmapDisplayer(600)). after call notifyDataSetChanged(), the screen splashing

NtcWai avatar Sep 10 '13 08:09 NtcWai

waiting for ans :(

ansuangry avatar Sep 13 '13 10:09 ansuangry

:-1:

ansuangry avatar Sep 13 '13 10:09 ansuangry

You can use custom displayer:

new FadeInBitmapDisplayer(300) {

            @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;
                }
            }

        }

Problem that people don't read documentation and samples before using it :)

IstiN avatar Sep 13 '13 11:09 IstiN

It worked :dancers: Thank you, IstiN

NtcWai avatar Sep 16 '13 02:09 NtcWai

This doesn't work for me. I'm using this options

    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 each item selected I call notifyDataSetChanged and all of the images start reloading. This leads to screen blinking everytime I select an item. It looks like UIL doesn't check if it's loading the same data to the ImageVIew that it already has.

Lingviston avatar Sep 30 '13 20:09 Lingviston

solve istin doesn't work

ta4 avatar Sep 30 '13 21:09 ta4

Ok, I found the only way to avoid this. I added these lines to my adapter:

    String thumbTag = (String) thumbnail.getTag();
    if (thumbTag == null || !thumbTag.equals(item.path))
        ImageManager.displayImage("file:/" + item.path, thumbnail);
    thumbnail.setTag(item.path);

Lingviston avatar Oct 01 '13 06:10 Lingviston

no luck no one work for me :( plz help me people ............... i m waiting ?

ansuangry avatar Oct 15 '13 10:10 ansuangry

.memoryCacheSize(2 * 1024 * 1024) is too small comment this line .

lizijin avatar Oct 21 '13 03:10 lizijin

Let's move the discussion into related issue - https://github.com/nostra13/Android-Universal-Image-Loader/issues/376

nostra13 avatar Dec 01 '13 11:12 nostra13