【问题标题】:Unlimited Disk Cache is not working in image loader 1.9.5无限磁盘缓存在图像加载器 1.9.5 中不起作用
【发布时间】:2016-06-09 07:32:39
【问题描述】:

Unlimited Disk Cache 在universal-image-loader:1.9.5 中不起作用 我想将图像存储在 sdcard 中。 请分享此代码的替换。 这是我的代码:

public void initImageLoader() {

    try {
        File cacheDir = StorageUtils.getOwnCacheDirectory(getApplicationContext(), getString(R.string.app_name));
        DisplayImageOptions options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.mipmap.ic_launcher)
                .showImageOnLoading(R.mipmap.ic_launcher).showImageOnFail(R.mipmap.ic_launcher).cacheInMemory(true).cacheOnDisk(true)
                .bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true).build();

        @SuppressWarnings("deprecation")
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
                .discCache(new UnlimitedDiscCache(cacheDir)).defaultDisplayImageOptions(options).build();
        ImageLoader.getInstance().init(config);
        L.writeLogs(false);
    } catch (Exception e) {
        e.printStackTrace();
    }

}

Gradle 依赖项:

compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'

【问题讨论】:

    标签: android android-studio universal-image-loader


    【解决方案1】:

    请参阅https://github.com/nostra13/Android-Universal-Image-Loader/wiki/Configuration 的详细信息,类名称已更改为“UnlimitedDiskCache”,但不是您编码的“UnlimitedDiscCache”。

    【讨论】:

      猜你喜欢
      • 2018-02-05
      • 2017-03-10
      • 2016-06-18
      • 2016-02-29
      • 2014-02-13
      • 2023-03-20
      • 1970-01-01
      • 2013-02-10
      • 2015-05-16
      相关资源
      最近更新 更多