title: SimpleOnGestureListener not working
body: <p>I want to change between activities by swiping in my <strong>MainActivity</strong>. I declared an object from <strong>GestureDetectorCompat</strong> and initialized it in method <strong>onCreate</strong> like that:</p>
  
  <pre><code>gestureObject = new GestureDetectorCompat(MainActivity.this, new GestureListener());
  </code></pre>
  
  <p>Also, I override <strong>onTouchEvent</strong> like that:</p>
  
  <pre><code>@Override
  public boolean onTouchEvent(MotionEvent event) {
      this.gestureObject.onTouchEvent(event);
      return super.onTouchEvent(event);
  }
  </code></pre>
  
  <p>and my <strong>MainActivity</strong> extends from <strong>AppCompatActivity</strong> and implements <strong>NavigationView.OnNavigationItemSelectedListener, OnMenuItemClickListener</strong>.</p>
  
  <p>GestureListener code is:</p>
  
  <pre><code>private class GestureListener extends GestureDetector.SimpleOnGestureListener {
  
      @Override
      public void onLongPress(MotionEvent e) {
          Log.e(TAG, "long pressed");
          super.onLongPress(e);
      }
  
      @Override
      public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
  
          Log.e(TAG, "on Flig");
  
          if (e2.getX() &gt; e1.getX()) {
  
              Log.e(TAG, "left to right");
          }
          return true;
      }
  }
  </code></pre>
  
  <p>but it does not work.</p>
  
  <p>Is it related to <strong>navigationView</strong>?</p>
  
  <p>What can I do?</p>