aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
index 702215341b..eef5d1911b 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
@@ -1,5 +1,6 @@
package org.scummvm.scummvm;
+import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.content.Context;
@@ -69,13 +70,16 @@ public class ScummVMEvents implements
}
public boolean onGenericMotionEvent(final MotionEvent e) {
- if((e.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
- _scummvm.pushEvent(JE_JOYSTICK, e.getAction(),
- (int)(e.getAxisValue(MotionEvent.AXIS_X)*100),
- (int)(e.getAxisValue(MotionEvent.AXIS_Y)*100),
- 0, 0);
- return true;
- }
+ // Make sure we're running on Android 3.1 or higher to use getAxisValue()
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
+ if((e.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
+ _scummvm.pushEvent(JE_JOYSTICK, e.getAction(),
+ (int)(e.getAxisValue(MotionEvent.AXIS_X)*100),
+ (int)(e.getAxisValue(MotionEvent.AXIS_Y)*100),
+ 0, 0);
+ return true;
+ }
+ }
return false;
}