title: problem with swipe (fling) gesture recognition on ImageView in Android
body: <p>I am trying to work a simple swipe/fling gesture recognizer on an ImageView in my app. However, I dont see anything. Can any one kindly have a look at the code and let me know what am I missing here ? Thanks.</p>
  
  <p>Note1: from my debugging, I can see that execution does go inside the GestureListener. However, it gets a return false from there.</p>
  
  <p>code:</p>
  
  <pre><code>public class ViewSuccess extends Activity {
  
  private static final int SWIPE_MIN_DISTANCE = 120;
  private static final int SWIPE_MAX_OFF_PATH = 250;
  private static final int SWIPE_THRESHOLD_VELOCITY = 200;
  private GestureDetector gestureDetector;
  View.OnTouchListener gestureListener;
  ImageView movieFrame;
  
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
  
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.test);
  
  
  
      imageLoader=new ImageLoader(getApplicationContext());
  
  
  
  
      movieFrame = (ImageView) findViewById(R.id.widget32);
      movieFrame.setImageResource(R.drawable.sample);
  
  
  
  
  
   // Gesture detection
      gestureDetector = new GestureDetector(new MyGestureDetector());
      gestureListener = new View.OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
              if (gestureDetector.onTouchEvent(event)) {
                  return true;
              }
              return false;
          }
      };
  
      movieFrame.setOnTouchListener(gestureListener);
  
  
  class MyGestureDetector extends SimpleOnGestureListener {
      @Override
      public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
  
          System.out.println("in gesture recognizer !!!");
  
          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) {
                  Toast.makeText(ViewSuccess.this, "Left Swipe", Toast.LENGTH_SHORT).show();
              }  else if (e2.getX() - e1.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
                  Toast.makeText(ViewSuccess.this, "Right Swipe", Toast.LENGTH_SHORT).show();
              }
          } catch (Exception e) {
              // nothing
          }
          return false;
      }
  }
  }
  </code></pre>