diff --git a/engine/android/src/org/libsdl/app/SDLActivity.java b/engine/android/src/org/libsdl/app/SDLActivity.java index 1c81812de..332d84386 100644 --- a/engine/android/src/org/libsdl/app/SDLActivity.java +++ b/engine/android/src/org/libsdl/app/SDLActivity.java @@ -195,13 +195,13 @@ protected void onDestroy() { SDLActivity.nativeQuit(); // Now wait for the SDL thread to quit - if (mSDLThread != null) { + if (SDLActivity.mSDLThread != null) { try { - mSDLThread.join(); + SDLActivity.mSDLThread.join(); } catch(Exception e) { Log.v("SDL", "Problem stopping thread: " + e); } - mSDLThread = null; + SDLActivity.mSDLThread = null; //Log.v("SDL", "Finished waiting for SDL thread"); } @@ -558,7 +558,7 @@ public void surfaceDestroyed(SurfaceHolder holder) { Log.v("SDL", "surfaceDestroyed()"); // Call this *before* setting mIsSurfaceReady to 'false' if (SDLActivity.wakeLock.isHeld()) SDLActivity.wakeLock.release(); - //SDLActivity.handlePause(); + SDLActivity.handlePause(); SDLActivity.mIsSurfaceReady = false; SDLActivity.onNativeSurfaceDestroyed(); } @@ -623,7 +623,6 @@ public void surfaceChanged(SurfaceHolder holder, SDLActivity.mIsSurfaceReady = true; SDLActivity.onNativeSurfaceChanged(); - if (SDLActivity.mSDLThread == null) { // This is the entry point to the C app. // Start up the C app thread and enable sensor input for the first time @@ -631,6 +630,9 @@ public void surfaceChanged(SurfaceHolder holder, SDLActivity.mSDLThread = new Thread(new SDLMain(), "SDLThread"); enableSensor(Sensor.TYPE_ACCELEROMETER, false); SDLActivity.mSDLThread.start(); + } else { + if (!SDLActivity.wakeLock.isHeld()) SDLActivity.wakeLock.acquire(); + SDLActivity.handleResume(); } }