Back to project page FeedListViewDemo.
The source code is released under:
MIT License
If you think the Android project FeedListViewDemo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package io.bxbxbai.androiddemos.utils; /* www.jav a 2 s . c o m*/ import android.graphics.Bitmap; import android.util.LruCache; import com.android.volley.toolbox.ImageLoader; /** * Created by baia on 14-9-11. */ public class LruBitmapCache extends LruCache<String, Bitmap> implements ImageLoader.ImageCache { public static int getDefaultLruCacheSize() { final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); return maxMemory / 8; } public LruBitmapCache() { this(getDefaultLruCacheSize()); } public LruBitmapCache(int memory) { super(memory); } @Override public Bitmap getBitmap(String url) { return get(url); } @Override public void putBitmap(String url, Bitmap bitmap) { put(url, bitmap); } @Override protected int sizeOf(String key, Bitmap value) { return value.getRowBytes() * value.getHeight() / 1024; } }