Soft References for Android 2.3+

380 views Asked by At

I have an app that loads a lot of bitmaps to form one large one.

I use soft references to allow these bitmaps to be stored appropriately. You are able to scroll over them with no problem on android OS < 2.3 However, once you get to 2.3 or higher, Android became much more aggressive with its soft reference collection. Since this happens, the app then runs very slowly on these newer phones.

I've seen this as a documented issue here:

http://code.google.com/p/android/issues/detail?id=20015

Does anybody know a good way to work around this? It's ridiculous that an app works way worse on a newer phone! Thanks for the help.

1

There are 1 answers

0
user936414 On

Soft references and weak references are handled in a different way above android 3.0. So it is better if you don't use them for bitmaps. You can use alternate methods like scaling down the bitmaps, disk cache, memory cache, etc. For more details on how to handle bitmaps refer http://developer.android.com/training/displaying-bitmaps/index.html