You can explore more about Multi-touch Android, which is available from the Android 2.0 and was improved in the version 2.2.
The MotionEvent.ACTION_POINTER_DOWN
and MotionEvent.ACTION_POINTER_UP
are sent from the second finger. To the first finger and MotionEvent.ACTION_DOWN
and MotionEvent.ACTION_UP
are used.
The method getPointerCount()
in MotionEvent
allows determining the number of pointers on the device. All events and pointer positions are included in the instance of MotionEvent
that you receive in the method OnTouch()
.
To track the touch events from various tips you have to use the methods MotionEvent.getActionIndex()
and the MotionEvent.getActionMasked()
to identify the index of the pointer and the touch event that happened to this pointer.
This pointer index can change over time if a finger is lifted from the device. See the image of the dots pressed:
ACTION_DOWN
is for the first finger that touches the screen. This starts the gesture. The pointer data for this finger is always in the index 0
in MotionEvent
.
ACTION_POINTER_DOWN
is for extra fingers entering the screen other than the first. The pointer data for this finger is in the index returned by getActionIndex()
.
ACTION_POINTER_UP
is sent when the finger leaves the screen, but at least one finger is still touching it. The last sample of data on the finger that rose is in the index returned by getActionIndex()
.
ACTION_UP
is sent when the last one leaves the screen finger. The last data sample on the finger that went up is in the index 0
. This ends the gesture.
ACTION_CANCEL
means the whole gesture was aborted for some reason. This ends the gesture.
Details
This can help you. http://www.survivingwithandroid.com/2012/08/multitouch-in-android.html
– Reginaldo Rigo
I found it so peaceful to learn the multi-touch as I could use it now to activate the same or other event? In other words, more than one key needs to be applied by swiping your finger across the screen without taking it off.
– Maico Ribeiro
Did you get the answer you wanted? Or do you need something else?
– viana
Ah yes I got thank you was to produce this game https://play.google.com/store/apps/details?id=br.com.digital.onuse.xilofonenene
– Maico Ribeiro