2

Haven't been able to find this one out.

How are Bitmaps stored in memory in Android? More specifically what I'm looking for is, does it store the information pixel by pixel, or does it use any sort of algorithm to reduce the number of stored pixels, like storing a single pixel and a number for how many times to repeat it in a row. I'm wondering about this because we're having trouble fitting all the images we want into our game. If it does use some sort of algorithm, then we can do something to the original image to cut down on memory consumption, right?

Jesse Jashinsky
  • 10,313
  • 6
  • 38
  • 63

2 Answers2

1

Bitmaps are stored compressed, but you pretty much can't display one without assembling the pixels at some point. Your best bet is probably to save your limited CPU heap and push your images into the GPU as compressed OpenGL ES textures.

Additional: Have a look at Displaying Bitmaps Efficiently. Also recycle your bitmaps if it helps.

Community
  • 1
  • 1
Sparky
  • 8,437
  • 1
  • 29
  • 41
  • 2
    Bitmaps are stored compressed **on disk**, in memory they are stored as regular bitmaps. – K-ballo May 26 '12 at 19:44
  • Except from what I've read, changing the program over to OpenGL ES Textures would require a major overhaul of the program. I just REALLY don't want to do that. – Jesse Jashinsky May 26 '12 at 20:10
0

While an implementation may choose to use RLE to store bitmaps in memory, I very much doubt one would do so since it would be inefficient to operate with them.

On Android 3.0 and above, you can request a larger heap.

K-ballo
  • 80,396
  • 20
  • 159
  • 169