2
無限磁盤緩存在通用圖像加載器中不起作用:1.9.5 我想將圖像存儲在SD卡中。 請分享此代碼的替代品。 這裏是我的代碼:無限磁盤緩存無法在圖像加載器中工作1.9.5
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();
}
}
搖籃依賴關係:
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'