Hysterize cached UIL images after 2 days in android
I am using Universal Image Library (UIL) to load images into my application.
Now the problem is that I can have different images on the same url. I mean today I have an image of a cat in the url and tomorrow I might have a dog in the same url. So I want to check that if the cached image is 2 days old then delete it and reload the image.
This is my config.
File cacheDir = StorageUtils.getOwnCacheDirectory(this, "FriendListCache");
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
// You can pass your own memory cache implementation
.diskCache(new UnlimitedDiscCache(cacheDir))
.diskCacheFileNameGenerator(new HashCodeFileNameGenerator())
.build();
ImageLoader.getInstance().init(config);
And these are the image upload options.
imageLoader = ImageLoader.getInstance();
options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.medium_load)
.cacheInMemory(true)
.cacheOnDisk(true)
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.decodingOptions(resizeOptions)
.displayer(new RoundedBitmapDisplayer(160))
.build();
+3
source to share
1 answer