/** * Called by onPause or surfaceDestroyed. Even if surfaceDestroyed is the first to be called, * mIsSurfaceReady should still be set to 'true' during the call to onPause (in a usual scenario). */ public static void handlePause() { if (!SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady) { SDLActivity.mIsPaused = true; SDLActivity.nativePause(); mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, false); } }
// Called when we lose the surface @Override public void surfaceDestroyed(SurfaceHolder holder) { Log.v("SDL", "surfaceDestroyed()"); if (!SDLActivity.mIsPaused) { SDLActivity.mIsPaused = true; SDLActivity.nativePause(); } enableSensor(Sensor.TYPE_ACCELEROMETER, false); }