Looking for a simple open source non-copyleft caching for Android (SDK 7+) class.
The purpose is primary to store the Bitmap
s fetched asynchronously (so
Ignition is what are you looking for: https://github.com/kaeppler/ignition. It allows you to cache images, serialized objects. For cashing part, work with ignition-support
Here's the API for ignition support: http://kaeppler.github.com/ignition-docs/ignition-support/apidocs/.
The plain LruCache suggested above is an in memory cache. From your question it sounds like you are looking for a disk cache solution.
Read the Disk Cache of the Caching Bitmaps android training doc.
Then take a look at the DiskLruCache implementation discussed on the following thread : Using DiskLruCache in android 4.0 does not provide for openCache method
You can grab the DiskLruCache source on GitHub.
How about android.util.LruCache
? If you need to support older platforms, simply copy it in you project. EDIT: it's actually in the compat/support library.
You can create your own image cache following this official android documentation that not only gives you the code, but also explains how it works:
http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html
They also explain the whole process, from loading bitmaps, processing them in a background thread, caching them and displaying them
http://developer.android.com/training/displaying-bitmaps/index.html
ICSDiskLruCache.java. This is a port of the DiskLruCache available in ICS and later versions of Android, open-sourced by Google as part of the IO 2012 Android App so it works with versions down to (at least) API level 7.
Find the source at http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/util/ICSDiskLruCache.java
http://docs.guava-libraries.googlecode.com/git-history/v12.0/javadoc/com/google/common/cache/package-summary.html