I am having trouble implementing Image cache using the new Volley library. In the presentation, code look like this
mRequestQueue = Volley.newRequestQueue(co
this is comes in new API to handle the OOM
public class BitmapMemCache extends LruCache implements ImageCache {
public BitmapMemCache() {
this((int) (Runtime.getRuntime().maxMemory() / 1024) / 8);
}
public BitmapMemCache(int sizeInKiloBytes) {
super(sizeInKiloBytes);
}
@Override
protected int sizeOf(String key, Bitmap bitmap) {
int size = bitmap.getByteCount() / 1024;
return size;
}
public boolean contains(String key) {
return get(key) != null;
}
public Bitmap getBitmap(String key) {
Bitmap bitmap = get(key);
return bitmap;
}
public void putBitmap(String url, Bitmap bitmap) {
put(url, bitmap);
}
}