user1104939
user1104939

Reputation: 1425

OutOfMemoryError Android

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?

Upvotes: 0

Views: 189

Answers (1)

Wozza
Wozza

Reputation: 622

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.

Upvotes: 1

Related Questions