android - Can I force Universal Image Loader to cache only internally? -
having cache saved externally(sdcard) cause not deleted during uninstall. don't want happen, can edit uil
library such saves cache internally(inside app). i'm using limitedagedisccache
anyway deleted in given time.
if yes, should alter getowncachedirectory
method storageutils.class
?
you can use imageloaderconfiguration.builder(context)'s method, diskcache(), set diskcache universal image loader. , customized disk cache prefer internal cache.
and can create internal storage public method universal-image-loader, storageutils.
for example,
// false indicator don't prefer external storage. file cachedir = storageutils.getcachedirectory(context, false); // avoid exception, still prepare default 1 universal image loader file reservecachedir = storageutils.getcachedirectory(context); long cachemaxsize = 15 * 1024 * 1024; // 15 mb diskcache diskcache; try { diskcache = new lrudisccache(cachedir, reservecachedir, defaultconfigurationfactory.createfilenamegenerator(), cachemaxsize, 0); } catch (ioexception e) { e.printstacktrace(); // if cannot use lrudisccache internal cache, jut use defaultconfigurationfactory instead diskcache = defaultconfigurationfactory.creatediskcache(context, defaultconfigurationfactory.createfilenamegenerator(), cachemaxsize, 0); } imageloaderconfiguration.builder builder = new imageloaderconfiguration.builder(context) .diskcache(diskcache); imageloaderconfiguration config = builder.build(); imageloader.getinstance().init(config);
hope useful you.
Comments
Post a Comment