i'm trying to differentiate between a joystick and a d-pad input. i always get the same Event source (16777232). it doesnt matter if i push the d-pad or the turn the joystick.
i'm using a ipega gamecontroller
my problem is:
First:
when I turn the left joystick to the right:
1. dispatchGenericMotionEvent(MotionEvent motionEvent)
is triggered. and
a= 16777232(SOURCE_JOYSTICK)
2. It will forward to dispatchKeyEvent(KeyEvent event)
Second:
When I turn the right joystick to the right:
1. ispatchGenericMotionEvent(MotionEvent motionEvent)
is triggered. and
a= 16777232(SOURCE_JOYSTICK)
2. It does forward to dispatchKeyEvent(KeyEvent event)
Third:
When I push the left/right/up/down d-pad button:
1.ispatchGenericMotionEvent(MotionEvent motionEvent)
is triggered. and
a= 16777232(SOURCE_JOYSTICK)
2. It will forward to dispatchKeyEvent(KeyEvent event)
@Override
public boolean dispatchGenericMotionEvent(MotionEvent motionEvent)
{
int a=motionEvent.getSource();
return super.dispatchGenericMotionEvent(motionEvent);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
int a=motionEvent.getSource();
return super.dispatchKeyEvent(event);
}