My entire game slows down when returning from another app in the emulator (ie pressing the phone button, then back). frame rate drops by half - which turns it into sludge.
Everything is still there, apart from the thread which I kill when the (only) view is surfaceDestroyed (after calling join repeatedly, as with the lander sample.). I make a new thread and attach it - and the game runs, after a fashion.
if (_thread.getState() == Thread.State.TERMINATED)
{
_thread = null;
_thread = new TutorialThread(getHolder(), this);
_thread.setRunning(true);
_thread.start();
}
else
{
_thread.setRunning(true);
_thread.start();
}
This was after some headbanging and searching on this forum and the game crashing when returning. All the big objects in the game (bitmaps, sound etc) are in the main activity so they don't need to be destroyed or recreated I hope. Music is paused onPause and restarted onResume. It all works much more smoothly on a real phone (htc desire) but I'm worried this behaviour is something to do with 1.6 (which the emulator runs for broad compatibility) or something has been left dangling.
LOGCAT - Lots of SurfaceFlinger messages do turn up (write blocked for n ms) SurfaceFlinger ("executeScheduledBroadcasts skipped, contention on the client") and SurfaceComposerClient whinges about "lock_layer" timing out.
Also, running and jumping back to the home page then running the app (several times) on both the htc and the emulator will eventually cause the app to crash, but with no red issues turning up in Logcat. I'm baffled - any help much appreciated.
Cheers, Robin.