How we can check how many fingers tap on the screen in java?

194 Views Asked by At

What I'm trying to do is, When i click on the application screen I want to get how many Fingers tap on the screen ? Means 1 finger tap, 2 finger tap and three finger tap.

1

There are 1 best solutions below

0
iForests On

Use MotionEvent.getPointerCount(). You can read more details here: Respond to touch events

public boolean onTouchEvent(MotionEvent event) {
    int action = event.getAction();
    switch (action & MotionEvent.ACTION_MASK) {
        case MotionEvent.ACTION_POINTER_DOWN:
            int count = event.getPointerCount();
            // TODO: Do something you want here
            break;
    }
}