2

I'm implementing an application which detects and draws multiple pointers on an android phone.

However, I noticed that when I use the side of my hand, or when I try to make it process large surfaces, my app receives multiple ACTION_CANCEL events. Here's the code I use to handle touch events :

@Override
public boolean onTouchEvent(MotionEvent event) {
    switch (MotionEventCompat.getActionMasked(event)) {
        case MotionEvent.ACTION_DOWN:
            Log.e("TouchEvent", "I N I T - D O W N");
            onFirstPointerDown(event);
            break;
        case MotionEvent.ACTION_UP:
            Log.e("TouchEvent", "I N I T - U P");
            onLastPointerUp(event);
            break;
        case MotionEvent.ACTION_MOVE:
            onPointerMove(event);
            break;
        case MotionEvent.ACTION_POINTER_DOWN:
            Log.e("TouchEvent", "P O I N T E R - D O W N");
            onExtraPointerUpDown(event, false);
            break;
        case MotionEvent.ACTION_POINTER_UP:
            Log.e("TouchEvent", "P O I N T E R - U P");
            onExtraPointerUpDown(event, true);
            break;
        default:
            Log.e("TouchEvent", "A C T I O N - C A N C E L");
            break;
    }
    return true;
}

However, when I enable pointers debug info in my phone settings, everything is detected as expected.

Here's a picture of my application, along with android's pointers debug info :

How could I handle such behavior ?

Neir0
  • 21
  • 3

0 Answers0