+ 1
Android - Limited Bitmap memory problem
I have already coded some Android games. But in my current game, I am working with very large images. My problem is, that the notorious OutOfMemoryError keeps crashing the program. For my game is no way around containing a big count of Bitmaps simultaneously. Is there any way, how I can solve this problem?
6 ответов
+ 10
Hmm. Do you need all the bitmaps in memory? If not, have you tried to free the memory before you draw the next bitmap?
+ 9
Oh, I see, you need to draw.
Did you try this:
https://developer.android.com/topic/performance/graphics/load-bitmap.html
+ 7
Why do you need to use bmp's? Wouldn't png's be better?
+ 2
@Tashi N
Is it possible to draw in Android without Bitmaps?
I mean - You create a Bitmap out of a png file to draw it later on a canvas. Isn't it?
+ 1
@Tashi N
Yes, I tried it already. It improves the situation, but it does not remove the problem: Two more Bitmaps and there you are: OutOfMemoryError.
+ 1
@Tashi N
This is a good idea. I will test it tomorrow ... or The Day After Tomorrow ... Hopefully the application does not get slow, if I permanently recycle and create Bitmaps.
Thank you for your detailed help!