Bitmaps causing java.lang.OutOfMemoryError


Licensed User
My game runs in landscape mode. When I run it on my phone, if I leave the game and comeback a orientation change occurs cause its phone. Thus Activity_Create is used every time I leave and come back. My App starts over each time (which I don't want to happen), after the 3rd time I get java.lang.OutOfMemoryError error. The line that caused it is cluster.Initialize(File.DirAssets, "cluster.jpg").

Anyway to not have this happen? And how do I keep my game from thinking it is starting over on a phone because it forces an orientation change?

Below is the short version of my code. Thanks

Sub Globals
Dim cluster As Bitmap
cluster.Initialize(File.DirAssets, "cluster.jpg")
End Sub

Sub Activity_Create(FirstTime As Boolean)
end sub