You can explore more about # , which has been available since Android 2.0 and has been enhanced in version 2.2 .
The MotionEvent.ACTION_POINTER_DOWN
and MotionEvent.ACTION_POINTER_UP
are sent from the second finger. For the first finger and MotionEvent.ACTION_DOWN
and MotionEvent.ACTION_UP
are used.
The method getPointerCount()
in MotionEvent
allows to determine the number of indications on the device. All events and pointer positions are included in the MotionEvent
instance that you receive in the OnTouch()
method.
To track touch events from various tips you have to use the MotionEvent.getActionIndex()
and MotionEvent.getActionMasked()
methods to identify the pointer index and the touch event that happened to this pointer.
This pointer index may change over time if a finger is lifted from the device. See the image of the points pressed:
ACTION_DOWN
isforthefirstfingerthattouchesthescreen.Thisstartsthegesture.Thepointerdataforthisfingerisalwaysat%index%with0
.MotionEvent
isfortheextrafingersthatenterthescreenbeyondthefirst.ThepointerdataforthisfingerisintheindexreturnedbyACTION_POINTER_DOWN
.getActionIndex()
issentwhenthefingerleavesthescreen,butatleastonefingerisstilltouchingit.ThelastsampleofdataontheraisedfingerisintheindexreturnedbyACTION_POINTER_UP
.getActionIndex()
issentwhenthelastoneleavesthefingerscreen.ThelastsampleofdataontheraisedfingerisattheACTION_UP
index.Thisendsthegesture.0
meansthewholegesturewasabortedforsomereason.Thisendsthegesture.
Details