0

I need to load several large bitmaps into memory (to be used on screen at the same time, alpha png's).

I've loaded the bitmaps in efficiently using tutorial: (http://developer.android.com/training/displaying-bitmaps/load-bitmap.html)

My problem is, is that my bitmaps (only 3 of them) are going over the 32MB heap limit on high resolution screens. (silly limit).

What can I do now? Is there anyway of loading bitmaps outside the app assigned memory heap or am I stuck here?

  • are you sure that you're downsamping the images? What value of `inSampleSize` are you using: http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html – Cody Caughlan Oct 12 '12 at 22:12
  • Also look at this SO question: http://stackoverflow.com/questions/4753013/how-to-load-tiles-from-a-large-bitmap-in-android – Morrison Chang Oct 12 '12 at 22:13
  • I'm automatically down-sampling the images which seems to be working fine. Just having a few large bitmaps seems to be crashing the app with out of memory. – Abakiz Myth Oct 12 '12 at 22:15

1 Answers1

1

try using these decoding options:

options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.RGB_565;

then pass it to BitmapFactory decoder, if your images are displayed without too much artifact you can use 565 color space to save something like half of the memory

sherpya
  • 4,890
  • 2
  • 34
  • 50