Check if Image is in Cache - Universal Image Loader

fweigl picture fweigl · Mar 19, 2013 · Viewed 10.9k times · Source

I guess the title says it all. I tried:

imageLoader.getMemoryCache().get(key); 

with the image uri as key, but it always return null

although I enabled caching in the config.

Answer

nostra13 picture nostra13 · Mar 19, 2013

Use MemoryCacheUtils.

MemoryCacheUtils.findCachedBitmapsForImageUri(imageUri, ImageLoader.getInstance().getMemoryCache());

Memory cache can contain several bitmaps (diffenrent sizes) for one image. So memory cache use special keys, not image urls.