如何在Android的通用图像装载机保存图像? [英] How save image in Android Universal Image Loader?

查看:218
本文介绍了如何在Android的通用图像装载机保存图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

懒列表我用这个code和我的形象店一个文件夹名为 LazyList

In Lazy-List i use this code and my image store in a folder named LazyList

ImageLoader的ImageLoader的=新ImageLoader的(上下文);
imageLoader.DisplayImage(URL,ImageView的);

通用 - 图像 - 装载机我用这个

 ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())    
            .build();
    ImageLoader.getInstance().init(config);
    img = (ImageView) this.findViewById(R.id.test_id);
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.displayImage(URL.RECIPE_IMG_URL,img);

但是每次都使用互联网来获取图像,并没有我的形象店口ASLO添加任何文件夹中的 .diskCache(新UnlimitedDiscCache(新文件(MyFolder文件)))配置
但在 MyFolder中什么店。任何想法?

推荐答案

我发现我的答案。默认情况下缓存是禁用我要补充 DisplayImageOptions ImageLoaderConfiguration

I found my answer . By default caching is disable i should add DisplayImageOptions to ImageLoaderConfiguration

和这里是code

   DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
                .cacheInMemory(true)
                .cacheOnDisk(true)
                .build();

        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
                .defaultDisplayImageOptions(defaultOptions)
                .build();

这篇关于如何在Android的通用图像装载机保存图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆