java - Call method on subclass of imageLoader -


i'm trying call .evictall() on cache of imageloader, can't figure out how access method

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);             }         });      }   mrequestqueue = volleysingleton.getinstance().getrequestqueue();  mimageloader = volleysingleton.getinstance().getimageloader(); 

i've tried casting mimageloader object

((imageloader.imagecache) mimageloader).flushlrucache(); 

but throws error saying can't cast types.

how access .flushlrucache() method ?

if have not misunderstood, can keep reference imageloader.imagecache, in class

private imageloader.imagecache mimagecache;     private volleysingleton(){     mrequestqueue =  volley.newrequestqueue(volleyapplication.getappcontext());     mimageloader = new imageloader(this.mrequestqueue,  mimagecache = 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);         }       }); }  

and declare evictallimages in it

 public void evictallimages() {       if (mimagecache != null) {            mimagecache.flushlrucache();       }  } 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -