title: Android SimpleOnGestureListener.onFling getting a null MotionEvent
body: <p>I am trying to detect a fling event on a simple Android application, but the first <code>MotionEvent</code> argument is always null. Why is the onFling method being called with a null argument? The <a href="http://developer.android.com/reference/android/view/GestureDetector.SimpleOnGestureListener.html" rel="noreferrer">Android documentation</a> says that it gets called when a fling event occurs with the initial on down MotionEvent and the matching up MotionEvent.</p>
  
  <pre><code>class MyGestureDetector extends SimpleOnGestureListener {
      @Override
      public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
          // e1 always == null, return early a null reference exception
          if (e1 == null) {
              return false;
          }
          if (e1.getY() - e2.getY() &gt; 120) {
              handleFlingEvent();
              return true;
          }
          return false;
      }
  }
  </code></pre>
  
  <p>The main Activity has this onTouchEvent method:</p>
  
  <pre><code>GestureDetector flingDetector = new GestureDetector(new MyGestureDetector());
  
  @Override
  public boolean onTouchEvent(MotionEvent event) {
      if (flingDetector.onTouchEvent(event)) {
          return true;
      }
      return super.onTouchEvent(event);
  }
  </code></pre>