add Bitmap to LruCache - Android App

Android examples for App:Cache

Description

add Bitmap to LruCache

Demo Code


//package com.book2s;
import android.graphics.Bitmap;
import android.util.LruCache;

public class Main {
    private static LruCache<String, Bitmap> mCache;

    public static void addBitmap(Bitmap bitmap, String key) {
        if (getBitmap(key) == null) {
            mCache.put(key, bitmap);/*from www  .j  a  va2 s . c o  m*/
        }
    }

    public static Bitmap getBitmap(String key) {
        return mCache.get(key);
    }
}

Related Tutorials