public boolean onGenericMotion(MotionEvent event) {
        boolean consumed = false;
        float rawValue, value;
//        logger.log(Level.INFO, "onGenericMotion event: {0}", event);
        event.getDeviceId();
        event.getSource();
//        logger.log(Level.INFO, "deviceId: {0}, source: {1}", new Object[]{event.getDeviceId(), event.getSource()});
        AndroidJoystick joystick = joystickIndex.get(event.getDeviceId());
        if (joystick != null) {
            for (int androidAxis: joystick.getAndroidAxes()) {
                String axisName = MotionEvent.axisToString(androidAxis);
                rawValue = event.getAxisValue(androidAxis);
                value = JoystickCompatibilityMappings.remapAxisRange(joystick.getAxis(androidAxis), rawValue);
                int action = event.getAction();
                if (action == MotionEvent.ACTION_MOVE) {
//                    logger.log(Level.INFO, "MOVE axis num: {0}, axisName: {1}, value: {2}",
//                            new Object[]{androidAxis, axisName, value});
                    JoystickAxis axis = joystick.getAxis(androidAxis);
                    if (axis != null) {
//                        logger.log(Level.INFO, "MOVE axis num: {0}, axisName: {1}, value: {2}, deadzone: {3}",
//                                new Object[]{androidAxis, axisName, value, axis.getDeadZone()});
                        JoyAxisEvent axisEvent = new JoyAxisEvent(axis, value, rawValue);
                        joyInput.addEvent(axisEvent);
                        consumed = true;
                    } else {
//                        logger.log(Level.INFO, "axis was null for axisName: {0}", axisName);
                    }
                } else {
//                    logger.log(Level.INFO, "action: {0}", action);
                }
            }
        }

        return consumed;
    }
Main class that creates and manages Android inputs for physical gamepads/joysticks.

@author iwgeric
jme3-android/src/main/java/com/jme3/input/android/AndroidJoystickJoyInput14.java