Tutorial by Examples

The Lru Cache will store all the added resources (values) for fast access until it reaches a memory limit, in which case it will drop the less used resource (value) to store the new one. To initialise the Lru cache you need to provide a maximum memory value. This value depends on your application r...
To add a resource to the cache you must provide a key and the resource. First make sure that the value is not in the cache already public void addResourceToMemoryCache(String key, Bitmap resource) { if (memoryCache.get(key) == null) memoryCache.put(key, resource); }
To get a resource from the cache simply pass the key of your resource (String in this example) public Bitmap getResourceFromMemoryCache(String key) { memoryCache.get(key); }

Page 1 of 1