How to force a cache clearing using Universal Image Loader Android?

坚强是说给别人听的谎言 提交于 2019-11-27 04:05:58
Bundeeteddee

If you are caching it both in memory and disc, for example:

ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())         
        .memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) 
        .discCache(new UnlimitedDiscCache(cacheDir)) 
.........

Ensure you remove it from both of them, then reload your image view.

MemoryCacheUtils.removeFromCache(url, ImageLoader.getInstance().getMemoryCache());
DiscCacheUtils.removeFromCache(url, ImageLoader.getInstance().getDiscCache());

This should work:

imageLoader.clearMemoryCache();
nostra13

I think you should delete cached image in memory cache when opening dialog. Use MemoryCacheUtil for that:

MemoryCacheUtils.removeFromCache(imageUrl, imageLoader.getMemoryCache());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!