nano nano - 1 year ago 95
Android Question

Equivalence of numberOfTouchesRequired (UIGestureRecognizer) for Android?

In iOS, we've the property numberOfTouchesRequired in UIGestureRecognizer class.
Its meaning is: the number of fingers required to tap for the gesture to be recognized.

@property(nonatomic) NSUInteger numberOfTouchesRequired


I want to detect when the user taps with two fingers at the same time in different parts of the screen.

Any help would be much appreciated.

Answer Source

It works a bit differently in Android, but you can get the same feature. You just need to override onTouchEvent(motionEvent)

There, you will be able to manipulate the event variable that contains among other things the number of fingers on the screen (event.getPointerCount() )