protected JoystickAxis addAxis(MotionRange motionRange) {

            String name = MotionEvent.axisToString(motionRange.getAxis());

            String original = MotionEvent.axisToString(motionRange.getAxis());
            if (motionRange.getAxis() == MotionEvent.AXIS_X) {
                original = JoystickAxis.X_AXIS;
            } else if (motionRange.getAxis() == MotionEvent.AXIS_Y) {
                original = JoystickAxis.Y_AXIS;
            } else if (motionRange.getAxis() == MotionEvent.AXIS_Z) {
                original = JoystickAxis.Z_AXIS;
            } else if (motionRange.getAxis() == MotionEvent.AXIS_RZ) {
                original = JoystickAxis.Z_ROTATION;
            } else if (motionRange.getAxis() == MotionEvent.AXIS_HAT_X) {
                original = JoystickAxis.POV_X;
            } else if (motionRange.getAxis() == MotionEvent.AXIS_HAT_Y) {
                original = JoystickAxis.POV_Y;
            }
            String logicalId = JoystickCompatibilityMappings.remapAxis( getName(), original );
            if (logger.isLoggable(Level.FINE) && !Objects.equals(logicalId, original)) {
                logger.log(Level.FINE, "Remapped: {0} to: {1}",
                        new Object[]{original, logicalId});
            }

            JoystickAxis axis = new DefaultJoystickAxis(getInputManager(),
                                                this,
                                                getAxisCount(),
                                                name,
                                                logicalId,
                                                true,
                                                true,
                                                motionRange.getFlat());

            if (motionRange.getAxis() == MotionEvent.AXIS_X) {
                xAxis = axis;
            }
            if (motionRange.getAxis() == MotionEvent.AXIS_Y) {
                yAxis = axis;
            }
            if (motionRange.getAxis() == MotionEvent.AXIS_HAT_X) {
                povX = axis;
            }
            if (motionRange.getAxis() == MotionEvent.AXIS_HAT_Y) {
                povY = axis;
            }

            addAxis(axis);
            axisIndex.put(motionRange.getAxis(), axis);
            return axis;
        }
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