nostra13 / Android-Universal-Image-Loader

Powerful and flexible library for loading, caching and displaying images on Android.
Apache License 2.0
16.78k stars 6.1k forks source link

how to know image already present in diskcache or memorycache #1171

Open akash09766 opened 8 years ago

akash09766 commented 8 years ago

can achieve this kind of functionality : like for ex : boolean stat = imageloader.isImageCache(url);

if image is already cache some where it will return true otherwise false.

pavelaizen commented 8 years ago

This is the way: public boolean isImageInCache(String imageUrl) { List<Bitmap> cachedBitmapsForImageUri = MemoryCacheUtils.findCachedBitmapsForImageUri(imageUrl, ImageLoader.getInstance().getMemoryCache()); File inCache = DiskCacheUtils.findInCache(imageUrl, ImageLoader.getInstance().getDiskCache()); return cachedBitmapsForImageUri != null && !cachedBitmapsForImageUri.isEmpty() || inCache != null && inCache.length() > 0; }