I'm trying to implement pinch-zoom in an app I'm making and am having issues with the onTouch event. It appears that the pointer up & down actions do not fire immediately, like you won't get a pointer up or down until an action move occurs. So what happens if both fingers hit the screen nearly simultaneously is that the 2nd finger (should be pointer(1)) gets a move action before pointer down is called, making the code think it's a DRAG not a pinch zoom. Anyone else seen this? Anyway around it? Thanks.
be sure to include MotionEvent.ACTION_MASK in your switch. For example:
switch(event.getAction() & MotionEvent.ACTION_MASK){
case MotionEvent.ACTION_DOWN:
some code
break;
case MotionEvent.ACTION_POINTER_DOWN:
ETC
faced the same issue turned out that ACTION_POINTER_2_DOWN was being fired in my app when i touched the second finger and after that ACTION_MOVE was fired the getAction() method gives the event number which needs to be checked against this list
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With