MotionEvent's documentation states in Consistency Guarantees that: "(For touch events)... pointers go down one at a time, move around as a group and then go up one at a time or are canceled".
If I understand correctly, there are two ways one can determine the action that triggered onTouchEvent()
:
MotionEvent.getAction()
MotionEvent.getActionMasked()
withMotionEvent.getActionIndex()
(this should be used for multitouch, which is what I'm after)
Since getActionMasked()
always returns just ACTION_POINTER_DOWN
and ACTION_POINTER_UP
, according to Consistency Guarantees there should always be just one pointer passed inside MotionEvent
to onTouchEvent()
, which means that MotionEvent.getActionIndex()
will always return 0.
If that is so, what is the point of having MotionEvent.getActionIndex()
at all? In other words: what am I missing?
UPDATE: To further clarify my question: MotionEvent.getActionMasked()
returns just one action and MotionEvent.getActionIndex()
tells us which pointer it applies to. Does that mean that we can't get the action for other pointers? Or if it is the same for all pointers, why specify actionIndex at all?