Search code examples
androidmotionevent

PointerIndex versus id in android


I m referring to some websites like http://developer.android.com/reference/android/view/MotionEvent.html http://www.vogella.com/tutorials/AndroidTouch/article.html to learn MotionEvent for designing User Interface. The problem is i am getting confused with terminologies like pointerIndex,Id ,getActionIndex, getActionMasked and other important methods related to MotionEvent.


Solution

  • Motion events describe movements in terms of an action code and a set of axis values.The action code specifies the state change that occurred such as a pointer going down or up.

    Each pointer has a unique id that is assigned when it first goes down (indicated by ACTION_DOWN or ACTION_POINTER_DOWN). A pointer id remains valid until the pointer eventually goes up (indicated by ACTION_UP or ACTION_POINTER_UP) or when the gesture is canceled (indicated by ACTION_CANCEL).

    the pointer index of a pointer can change from one event to the next but the pointer id of a pointer is guaranteed to remain constant as long as the pointer remains active.