views:

30

answers:

0

I have a map in my application that shows locations from Gowalla. I use an ItemizedOverlay with a simple default marker, but as the items are drawn, I swap the default marker out with the location's icon downloaded 9and cached on disk) from Gowalla.

The problem is that if there are a lot of locations on screen (say 30), the size of the bitmaps in memory is enough to crash the activity. To prevent this, I only keep SoftReferences to the bitmaps. Unfortunately, this means that locations will flicker between the default marker and the icon (i.e., icons are loaded, but then there is memory pressure, so they're removed, but then reloaded because they're on screen...).

When I download the images from Gowalla, I'm already scaling them down based on the screen size (48x48 for HDPI, so 32x32 for MDPI, etc.), so these aren't huge images, but I'm still forced to choose between potentially crashing my app or having the icons flicker in and out. Is there some other way I can reduce the memory that a Bitmap uses?