问题
Call to cache
ImageLoader.getInstance().loadImage(cnt, imageUrl, new ImageLoadingListener()
/mnt/sdcard/Android/data/[package]/cache/40d1dxbmdamufgcs742bjraew
is createdImageLoader.getInstance().getDiscCache().get(imageUrl)
- returns/mnt/sdcard/Android/data/[package]/cache/40d1dxbmdamufgcs742bjraew
-> OKreboot device
ImageLoader.getInstance().getDiscCache().get(imageUrl)
- returns/data/data/[package]/cache/40d1dxbmdamufgcs742bjraew
-> KO (THIS FOLDER IS CREATED BUT ITS" EMPTY)
回答1:
Thanks to Doctoror Drive
https://github.com/nostra13/Android-Universal-Image-Loader/tree/master/library/src/com/nostra13/universalimageloader/core
/** * Returns application cache directory. Cache directory will be created on SD card * ("/Android/data/[app_package_name]/cache") if card is mounted. Else - Android defines cache directory on * device's file system. * * @param context Application context * @return Cache {@link File directory} */
public static File getCacheDirectory(Context context) {
File appCacheDir = null;
if (Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
appCacheDir = getExternalCacheDir(context);
}
if (appCacheDir == null) {
appCacheDir = context.getCacheDir();
}
return appCacheDir;
}
来源:https://stackoverflow.com/questions/16609277/imageloader-getinstance-getdisccache-getimageurl-returns-different-paths