简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM