Skip to content

Instantly share code, notes, and snippets.

@dostiharise
Last active August 29, 2015 14:06
Show Gist options
  • Save dostiharise/a742afa13bac986c8381 to your computer and use it in GitHub Desktop.
Save dostiharise/a742afa13bac986c8381 to your computer and use it in GitHub Desktop.
BitmapCache.java
/**
* BitmapCache.java
*
*
*
*/
package net.xxx.xxx.lib.server;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
import com.android.volley.toolbox.ImageLoader.ImageCache;
/**
* @author hari
*
*/
public class BitmapCache extends LruCache<String, Bitmap> implements ImageCache {
public BitmapCache(int maxSize) {
super(maxSize);
}
@Override
protected int sizeOf(String key, Bitmap value) {
return value.getRowBytes() * value.getHeight();
}
@Override
public Bitmap getBitmap(String url) {
return get(url);
}
@Override
public void putBitmap(String url, Bitmap bitmap) {
put(url, bitmap);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment