diff --git a/android-project/src/org/libsdl/app/SDLActivity.java b/android-project/src/org/libsdl/app/SDLActivity.java index c5714eeea..2b9cf7203 100644 --- a/android-project/src/org/libsdl/app/SDLActivity.java +++ b/android-project/src/org/libsdl/app/SDLActivity.java @@ -190,7 +190,7 @@ public class SDLActivity extends Activity { if (SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady && SDLActivity.mHasFocus) { SDLActivity.mIsPaused = false; SDLActivity.nativeResume(); - mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true); + mSurface.handleResume(); } } @@ -550,6 +550,15 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, mWidth = 1.0f; mHeight = 1.0f; } + + public void handleResume() { + setFocusable(true); + setFocusableInTouchMode(true); + requestFocus(); + setOnKeyListener(this); + setOnTouchListener(this); + enableSensor(Sensor.TYPE_ACCELEROMETER, true); + } public Surface getNativeSurface() { return getHolder().getSurface();