Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Universal Image Loader - removing single image from cache not working

I calling following code before loading an image:

String url = getUrlImageIcon();
MemoryCacheUtil.removeFromCache(url, ImageLoader.getInstance().getMemoryCache());
DiscCacheUtil.removeFromCache(url, ImageLoader.getInstance().getDiscCache());

ImageLoader.getInstance().displayImage(url, imageView, listener);

My Problem is, this is not deleting the image from cache, the image loader is still displaying the old image afterwards... The old image is not even existing on the server anymore...

How can I remove all cached files from an image correctly?

PS: I'm using the up-to-date version 1.9.1...

like image 770
prom85 Avatar asked Mar 02 '14 10:03

prom85


1 Answers

What @vanomart answered is perfect, just to update the answer. Currently, UIL supports,

MemoryCacheUtils.removeFromCache(imageUri, imageLoader.getMemoryCache());
DiskCacheUtils.removeFromCache(imageUri, imageLoader.getDiskCache());

So, there is better way to clear disk cache.

like image 59
Rohit Avatar answered Oct 27 '22 01:10

Rohit