title: Android: GestureDetector won't catch Gestures
body: <p>I have to GestureDetectors in my program. One works beautifully, the other doesn't. As far as I can tell they're both implemented the same way.</p>
  
  <p>Here's the code for implementing the one that isn't working:</p>
  
  <pre><code>myExcuseGestureDetector = new GestureDetector(new excuseGestureDetector());
  excuseView.setOnTouchListener(new View.OnTouchListener() {
      public boolean onTouch(View v, MotionEvent event) {
         if(myExcuseGestureDetector.onTouchEvent(event)){
           Log.d("Excuse Gesture Return","true");
           return true;
         }
         Log.d("Excuse Gesture Return","false");
         return false;
      }
  });
  </code></pre>
  
  <p>Then I have this block later which defines excuseGestureDetector</p>
  
  <pre><code>private class excuseGestureDetector extends SimpleOnGestureListener{
    @Override
       public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
     Log.d("MotionEvent","onFling");
           try {
               if (Math.abs(e1.getY() - e2.getY()) &gt; SWIPE_MAX_OFF_PATH)
                   return false;
               // right to left swipe
               if(e1.getX() - e2.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
                if(currExcuseNumber&lt;currExcuseSet.size()){
                 currExcuseNumber++;
                 loadNextExcuse(currExcuseNumber,1);
                  excuseView.setInAnimation(slideLeftExcuseIn);
                    excuseView.setOutAnimation(slideLeftExcuseOut);
                  excuseView.showNext();
                  return true;
                }
               }  else if (e2.getX() - e1.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
                if(currExcuseNumber &gt; 1){
                 loadNextExcuse(currExcuseNumber,0);
                  excuseView.setInAnimation(slideRightExcuseIn);
                    excuseView.setOutAnimation(slideRightExcuseOut);
                  excuseView.showPrevious();
                 return true;
                }
               }
           } catch (Exception e) {
               // nothing
           }
           return false;
       }
  }
  </code></pre>
  
  <p>For whatever reason, it doesn't register the fling at all. Regardless of whether the animation happens or not, the program should print out the Log.d("MotionEvent","onFling") that I'm trying to trace and it doesn't. All I know is that it does register that a touchevent of some sort has occured because it does trace out "Excuse Gesture Return" "false" from the first block I showed. Any thoughts on why it won't register the fling?</p>