Joystick API Android

user1974194 picture user1974194 · Jan 13, 2013 · Viewed 12.3k times · Source

The Android 3.1+ supports joystick and gamepad, but there are not any examples. I tried to use onTrackballEvent and it didn't work. How can I use joystick in my Android App?

Answer

Charlie Collins picture Charlie Collins · Jan 13, 2013

Check out the samples: http://developer.android.com/tools/samples/index.html

There is a GameControllerInput example in the "ApiDemos" project. Specifically /samples/android-rev/ApiDemos/src/com/example/android/apis/view/GameControllerInput.java

You can also find that online in a few places that mirror the code, such as: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.0.3_r1/com/example/android/apis/view/GameControllerInput.java