I receive axes position from my bluetooth gamepad controller in dispatchGenericMotionEvent(android.view. MotionEvent)
method.
My method:
@Override
public boolean dispatchGenericMotionEvent(final MotionEvent event) {
if( mPadListener==null ||
(event.getSource()&InputDeviceCompat.SOURCE_JOYSTICK)!=InputDeviceCompat.SOURCE_JOYSTICK ){
return super.dispatchGenericMotionEvent(event);
}
int historySize = event.getHistorySize();
for (int i = 0; i < historySize; i++) {
// Process the event at historical position i
Log.d("JOYSTICKMOVE",event.getHistoricalAxisValue(MotionEvent.AXIS_Y,i)+" "+event.getHistoricalAxisValue(MotionEvent.AXIS_Z,i));
}
// Process current position
Log.d("JOYSTICKMOVE",event.getAxisValue(MotionEvent.AXIS_Y)+" "+event.getAxisValue(MotionEvent.AXIS_Z));
return true;
}
The problem is that when I release all joystick axes, I'm not getting last axes values (0,0) in my log. It stops for example in (0.23,0.11) and appropriate values appear in logcat only after next move event. What's more - situation is the same even if I press normal button (button event is catch by completely other method dispatchKeyEvent(android.view.KeyEvent)
)
What's going on ?