Last active
December 21, 2015 18:29
-
-
Save pwittchen/6347865 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.volley.example.toolbox; | |
import com.android.volley.toolbox.ImageLoader.ImageCache; | |
import android.graphics.Bitmap; | |
import android.support.v4.util.LruCache; | |
public class BitmapLruCache extends LruCache<String, Bitmap> implements ImageCache { | |
public BitmapLruCache(int maxSize) { | |
super(maxSize); | |
} | |
// Fix thanks to Steven's comment: sizeOf method should not be overriden, | |
// when we are passing max image cache entries in another place of the code | |
// @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