Allocated heap memory and drawables of different size
I'm tracking allocated heap memory on my app and at maximum it's 15.5MB. Most of this comes from bitmaps. I have a folder named "drawable" that I place all my bitmaps in, so all devices will load the same bitmaps, no matter screen size. Test device is Desire HD. My question is: When a small screen device runs my app, will it allocate the same amount of memory? (keep in mind that I don't have smaller bitmaps for small screen devices).
The reason I'm doubting is that no matter what it's resized to, it comes from the same resource. For instance, I have found that drawing a 400*800 bitmap and drawing a 300*600 bitmap consumes different amounts of memory even though I strech them both to fill the screen.
If I use smaller bitmaps for small screen devices, I assume it will allocate le开发者_如何学Goss memmory. It's just that I have like 300 bitmaps and I'm trying to avoid the pain of having to copy and reduce the size of 300 bitmaps.
Another question while I'm at it: I read somewhere that the lowest maximum heap size is 16MB. Is this still true?
Your bitmaps will be resized automatically based on inDensity and inTargetDensity. This is of course slower than having multiple versions of the same bitmap but in your case it might be the best choice.
精彩评论