There's an activity in my app whose showing around 1000
very small sized bitmaps (Around 20kb
each bitmap). After it loads some of the bitmaps, there's an OutOfMemoryException
.
I was first reading about SoftReference
and it looked like it will solve my problem about the OOM exceptions
. But then, I read that it won't cache my bitmaps and will free them "too soon", so it will have to decode the bitmap again and "waste" time.So, I implemented the LruCache
.
How can I make sure that I will not get OOM exception
when implementing my LruCache
?
Maybe I should just use the SoftReference, because my main target is to avoid OOM
Or, this might be my solution? LruSoftCache