Reputation: 856
A few days ago, I began working on my first Android game. I opted to use OpenGL ES 2.0 since it was the most familiar alternative. However, I am currently unable to test the game on a real device, so I decided to use AVD instead, using a 4.0.3 virtual device with Intel HAXM installed. This seemed to work perfectly, but I have now encountered a really strange problem.
When compiling and running the game from Eclipse, it works just fine. However, if I then run the game a second time, either through the AVD or from Eclipse, nothing is drawn except the background color. If I change anything in the code so that Eclipse must recompile the application, everything once again works as it should, but only during the first run.
I have no idea what's going on. If I had to guess I would say that the AVD is acting up somehow, but does anyone know a way to fix this? If requested, I will provide relevant source code, but as I have no idea what could cause this kind of problem, I cannot provide any right now.
Upvotes: 0
Views: 211
Reputation: 856
It seems like the textures were being deleted when the application was paused, which led to it not drawing anything on the screen. Reloading the textures in the onResume
function fixed the issue.
Upvotes: 0
Reputation: 679
Do you have any code that is saving or loading your application state that isn't working. Perhaps through the onCreate/onStart/onPause functions? Perhaps you are writing some state out when you suspend or close your application that is being read back in incorrectly?? Calling Application->Clear Data would reset this state unless you are writing to a public area such as the sd-card.
Upvotes: 1