Stats

49 Contributors: 5 Monday, May 22, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

LruCache

Remarks

You should use Lru Cache in applications where repetitive resource loads would affect a smooth app behaviour. For example a photo gallery with big thumbnails (128x128).

Always be careful with the size of the Lru cache since setting it too high might affect the app.

After the Lru Cache is no longer useful avoid holding any references to it to allow the Garbage Collector to clean it up from memory.

For the best performance remember to load resources like bitmaps using the best practices like selecting a proper inSampleSize before adding it to the Lru cache.

Related Examples