image loading - Android Volley ImageLoader - BitmapLruCache parameter? -


i having trouble implementing image cache using new volley library. in presentation, code this

mrequestqueue = volley.newrequestqueue(context); mimageloader = new imageloader(mrequestqueue, new bitmaplrucache()); 

the bitmaplrucache not included in toolkit. idea how implement or point me resources?

http://www.youtube.com/watch?v=yhv8l9f44qo @14:38

thanks!

import android.graphics.bitmap; import android.support.v4.util.lrucache;  public class bitmaplrucache extends lrucache<string, bitmap> implements imagecache {     public static int getdefaultlrucachesize() {         final int maxmemory = (int) (runtime.getruntime().maxmemory() / 1024);         final int cachesize = maxmemory / 8;          return cachesize;     }      public bitmaplrucache() {         this(getdefaultlrucachesize());     }      public bitmaplrucache(int sizeinkilobytes) {         super(sizeinkilobytes);     }      @override     protected int sizeof(string key, bitmap value) {         return value.getrowbytes() * value.getheight() / 1024;     }      @override     public bitmap getbitmap(string url) {         return get(url);     }      @override     public void putbitmap(string url, bitmap bitmap) {         put(url, bitmap);     } } 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -