I have a problem regards the memory management of my game on Android 2.2.
There are several possible theories I could enumerate that could cause this:
- Loading bitmaps on a non-cache idea (I load it using the item’s bitmap object)
- I didn’t use the Bitmap.recycle()
- Because I’m using OOP design, I just using Iterator.remove() instead of nulling it
- Bitmap actual size reached 300KB [major cause of lag]
- MediaPlayer object was used to play audio animation
- Too much memory overhead before game-play [everything is already loaded]
Though enumerating the said items can be done by adjusting some of my style of coding it, my main concern is how can I code properly a game on Android 2.2 without causing the major lag on the phone.
- What analogy should I consider?
- Should I use OpenGL (but my game is only a 2D accelerometer game)?
- Should I only get the objects I need from the database (but that would mean leaving the access to the table open throughout the game)?
- Or others, kindly post your answer.
Your response is highly appreciated and thanks in advance!
As commented on by slayton, your question is not very focused. It appears that you are concerned with the memory footprint and performance of your app but unsure of where to start. I would recommend profiling your app. Find out where it spends most of its time processing or allocating memory. Then work on making that part of your code more efficient.
The Android SDK includes a nice profiling tool documented here:
http://developer.android.com/guide/developing/debugging/debugging-tracing.html