title: How to detect two-finger tap in Android?
body: <p>I need to detect two-finger tap in an <code>Android</code> app I'm working on. I'm also using <code>ScaleGestureDetector</code> and <code>GestureDetector</code> to detect tap, double-tap, long press and scale. </p>
  
  <p>In my <code>onTouchEvent</code> method I have:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Override
  public boolean onTouchEvent(MotionEvent event) {
      scaleGestureDetector.onTouchEvent(event);
      gestureDetector.onTouchEvent(event);
  
      switch (event.getActionMasked()) {
      case MotionEvent.ACTION_DOWN:
          activePointerId = event.getPointerId(0);
          break;
      .
      .
      .
      case MotionEvent.ACTION_POINTER_UP:
          int pointerId = event.getPointerId(event.getActionIndex());
  
          if (pointerId == activePointerId) {
              // change active pointer
          } else if (!scaleDetector.isInProgress() &amp;&amp; (event.getPointerCount() == 2)) {
              // handle two-finger tap
          }
          break;
      .
      .
      .
  </code></pre>
  
  <p>The problem is that scale is also detected as a two-finger tap. Any ideas about fixing this problem? Thanks!</p>