Search code examples
androiduniversal-image-loader

How to cache image with universal image loader in android


I use UniversalImageLoader library for android:

I would like to cache image but now it is downloading everytime:

DisplayImageOptions options = new DisplayImageOptions.Builder()
    .cacheOnDisk(true) 
    .build();


    ImageLoader.getInstance().displayImage(url, iv, options);

How should i configure the options to cache the images to disk?


Solution

  • Try both of this code :

            DisplayImageOptions options = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .build();
    

    I used both of them and the images are cached.