Code example for LruCache

0
 
    public ImageCache() throws IOException { 
    	final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
	    final int maxMemCacheSize = maxMemory / 3;
	     
	    cache = new LruCache<String, Bitmap>(maxMemCacheSize);
    } 
     
    public void add(String key, Bitmap bitmap) {
    	cache.put(key, bitmap);
    } 
     
    public Bitmap get(String key) {
    	return cache.get(key);
    } 
}