I'm using a volley singleton to load images
private VolleySingleton(){ mRequestQueue = Volley.newRequestQueue(VolleyApplication.getAppContext()); mImageLoader = new ImageLoader(this.mRequestQueue, new ImageLoader.ImageCache() { private final LruCache<String, Bitmap> mCache = new LruCache<String, Bitmap>(10); public void putBitmap(String url, Bitmap bitmap) { mCache.put(url, bitmap); } public Bitmap getBitmap(String url) { return mCache.get(url); } }); } I need to flush the cache to update the imageView when the photo is changed.
I've read about MemoryCacheUtils here but can't seem to implment it in my code, can I use MemoryCacheUtils in my code? if not is there a way to flush the cache in my imageLoader?
Edit
Exposing the LruCache
private VolleySingleton(){ mRequestQueue = Volley.newRequestQueue(VolleyApplication.getAppContext()); mImageLoader = new ImageLoader(this.mRequestQueue, new ImageLoader.ImageCache() { private final LruCache<String, Bitmap> mCache = new LruCache<String, Bitmap>(10); public void flushLruCache(){ mCache.evictAll();}; public void putBitmap(String url, Bitmap bitmap) { mCache.put(url, bitmap); } public Bitmap getBitmap(String url) { return mCache.get(url); } }); } I'm trying to access it with ImageLoader.ImageCache flush = (ImageLoader.ImageCache) mImageLoader;
I can't access it though.