The documentation says this:
The gesture begins with a motion event with ACTION_DOWN, which ensures that the first down pointer is positioned. Like every additional pointer that goes up or down, the structure generates a motion event with ACTION_POINTER_DOWN or ACTION_POINTER_UP, respectively.
So, I did an override of the onTouchEvent function in my activity:
@Override public boolean onTouchEvent(MotionEvent MEvent) { motionaction = MEvent.getAction(); if(motionaction == MotionEvent.ACTION_DOWN) { System.out.println("DEBUG MESSAGE POINTER1 " + MEvent.getActionIndex() ); } if(motionaction == MotionEvent.ACTION_POINTER_DOWN) { System.out.println("DEBUG MESSAGE POINTER2 " + MEvent.getActionIndex() ); } }
Unfortunately, the second, if never introduced. The activity contains 2 views with 2 OnTouchListener , I know that onTouchEvent is called only if the activity view does not use the event, so I tried to return false in and this way I can recognize only the first touch of the finger, but this does not allow the listener to receive the event ACTION_UP and does not allow me to recognize the touch of the second finger. I also tried to return true in the listener, but after manually calling the onTouchEvent function, but this allows me to recognize only the first touch of the finger.
What is wrong in my code?
source share