I want to cache objects of custom claas, which implements serializable using LRUCache in android. It is possible? If yes, how can I proceed to do the same?
Asked
Active
Viewed 993 times
0
-
you don't use SQLite instead? – gunar Jun 18 '13 at 11:20
-
Have you studied butmapFun sample for caching Bitmap objects?: http://developer.android.com/training/displaying-bitmaps/index.html – Laviniux Jun 18 '13 at 11:27
1 Answers
1
LruCache has the syntax of that of a Map i.e LruCache key value pair. I can't see any reason why you can't store objects of Custom class in it. It will behave like a Map. On the other hand LruCache is generally used to cache bitmaps.

V4Vendetta
- 11
- 1
-
Finally I succeed in adding object in disk cache. I was directly writing the serialized object into cache; it was storing also; but when application restarts, that object was getting cleared from cache. So I wrote that object in file using ObjectOutputStream and it worked! – Pankaj Deshpande Jul 18 '13 at 14:15