Search code examples
androiduniversal-image-loader

Check if Image is in Cache - Universal Image Loader


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.


Solution

  • 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.