title: The GestureDetector does not work (example from android developer)
body: <p>I am reading the gesture in android at android developer, and following the tutorial I tried to run the following codes:</p>
  
  <pre><code>public class MainActivity extends Activity implements OnGestureListener, OnDoubleTapListener {
  
      private static final String DEBUG_TAG = "Gestures";
      private GestureDetectorCompat mDetector;
  
      // Called when the activity is first created.
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          View v = new RelativeLayout(this);
          v.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
          setContentView(v);
          mDetector = new GestureDetectorCompat(this, this);
          mDetector.setOnDoubleTapListener(this);
      }
  
      @Override
      public boolean onTouchEvent(MotionEvent event) {
          this.mDetector.onTouchEvent(event);
          return super.onTouchEvent(event);
      }
  
      @Override
      public boolean onDown(MotionEvent event) {
          Log.d(DEBUG_TAG, "onDown: " + event.toString());
          return true;
      }
  
      @Override
      public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY) {
          Log.d(DEBUG_TAG, "onFling: " + event1.toString() + event2.toString());
          return true;
      }
  
      @Override
      public void onLongPress(MotionEvent event) {
          Log.d(DEBUG_TAG, "onLongPress: " + event.toString());
      }
  
      @Override
      public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
          Log.d(DEBUG_TAG, "onScroll: " + e1.toString() + e2.toString());
          return true;
      }
  
      @Override
      public void onShowPress(MotionEvent event) {
          Log.d(DEBUG_TAG, "onShowPress: " + event.toString());
      }
  
      @Override
      public boolean onSingleTapUp(MotionEvent event) {
          Log.d(DEBUG_TAG, "onSingleTapUp: " + event.toString());
          return true;
      }
  
      @Override
      public boolean onDoubleTap(MotionEvent event) {
          Log.d(DEBUG_TAG, "onDoubleTap: " + event.toString());
          return true;
      }
  
      @Override
      public boolean onDoubleTapEvent(MotionEvent event) {
          Log.d(DEBUG_TAG, "onDoubleTapEvent: " + event.toString());
          return true;
      }
  
      @Override
      public boolean onSingleTapConfirmed(MotionEvent event) {
          Log.d(DEBUG_TAG, "onSingleTapConfirmed: " + event.toString());
          return true;
      }
  }
  </code></pre>
  
  <p>The codes came from the site <a href="https://developer.android.com/training/gestures/detector.html#detect" rel="noreferrer">here</a>.</p>
  
  <p>But when I ran the app, I got no debug information when I click or long press the view.</p>
  
  <p>BTW, I test the app in both emulator and htc e1 device.</p>
  
  <p>What is the problem?</p>