title: onSwipeleft to right i get tag ScrollView and invalid pointerId=-1 onTouchEvent
body: <p>I have an events on swipe left and right on the screen but there is an invalid pointerId=-1 on TouchEvent that on some phones crashes the application here is the class i use </p>
  
  <pre><code>   public class OnSwipeTouchListener implements OnTouchListener {
      private final GestureDetector gestureDetector = new GestureDetector(new GestureListener());
       @Override
       public boolean onTouch(View arg0, MotionEvent arg1) {
      // TODO Auto-generated method stub
      return gestureDetector.onTouchEvent(arg1);
       }
      private final class GestureListener extends SimpleOnGestureListener {
  
          private static final int SWIPE_THRESHOLD = 100;
      private static final int SWIPE_VELOCITY_THRESHOLD = 100;
  
  
          @Override
          public boolean onDown(MotionEvent e) {
           return true;
          }
  
         @Override
         public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)  {
            boolean result = false;
            try {
                float diffY = e2.getY() - e1.getY();
                float diffX = e2.getX() - e1.getX();
  
               if (Math.abs(diffX) &gt; Math.abs(diffY)) {
                    if (Math.abs(diffX) &gt; SWIPE_THRESHOLD &amp;&amp; Math.abs(velocityX) &gt; SWIPE_VELOCITY_THRESHOLD) {
                      if (diffX &gt; 0) {
                          onSwipeRight();
                      } else {
                          onSwipeLeft();
                      }
                  }
                } 
           } catch (Exception exception) {
              exception.printStackTrace();
          }
          return result;
      }
  
  
  }
  
        public void onSwipeRight() {
        }
  
        public void onSwipeLeft() {
        }
  
  
  }
  </code></pre>
  
  <p>i get this error java.lang.IllegalArgumentException: pointerIndex out of range</p>
  
  <p>in my main activity class i use this </p>
  
  <pre><code>fullView = (View)findViewById(R.id.fullview);
     fullView.setOnTouchListener(imageViewSwiped);  -&gt; inside onCreate method
  </code></pre>
  
  <p>and after onCreate i use this</p>
  
  <pre><code>     OnTouchListener imageViewSwiped = new OnSwipeTouchListener()
        {
       public void onSwipeRight() {
  
              minusOne();
          }
          public void onSwipeLeft() {
             // Toast.makeText(MainActivity.this, "left", Toast.LENGTH_SHORT).show();
              plusOne();
          }
  };
  </code></pre>