简体   繁体   English

如何在Android中使用通用图像加载器缓存图像

[英]How to cache image with universal image loader in android

I use UniversalImageLoader library for android: 我为Android使用UniversalImageLoader库:

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. 我都使用了它们,图像被缓存了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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