I made a small Game that frequently needs to change the background.
For example setBackgroundDrawableResource(R.drawable.backgroundgame);
Now I get the error that I ran out of memory so my question is how do I unload the previous background from the memory?
I made a small Game that frequently needs to change the background. For example
Share
The garbage collector should eventually delete the images when they are no longer needed. It sounds as though you want to call the
recycle()method on the bitmap (link) to free up the space more quickly.