title: event.getAction() never use MotionEvent.ACTION_UP
body: <p>i have a problem with MotionEvent in the OnTouchListener. The <code>ACTION_DOWN</code> works perfectly, but it never use ACTION_UP
  I really don't know where is my problem, so if someone can help me with it, that would be really great, thank you. </p>
  
  <pre><code>public class MainActivity extends Activity {
      View.OnTouchListener gestureListener;
      private static final int MIN_DISTANCE = 50; 
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          LinearLayout layout = (LinearLayout) findViewById(R.id.layout); 
          layout.setOnTouchListener(new View.OnTouchListener() {
  
              float downX = 0, downY; 
              @Override
              public boolean onTouch(View v, MotionEvent event) {
                  // TODO Auto-generated method stub
  
                  switch(event.getAction()){
                  case MotionEvent.ACTION_DOWN :
                          downX = event.getX(); 
                          downY = event.getY();
                          Toast.makeText(getApplicationContext(), "action down", Toast.LENGTH_SHORT).show();
                      break;
                  case MotionEvent.ACTION_UP : 
  
                      Toast.makeText(getApplicationContext(), "action up", Toast.LENGTH_SHORT).show();
                          float deltaX = downX - event.getX(); 
                          Toast.makeText(getApplicationContext(), Math.abs(deltaX)+"k", Toast.LENGTH_SHORT).show();
                          if (Math.abs(deltaX) &gt; 3){
                              if(deltaX &lt; 0) { onLeftToRightSwipe(); return true; }
                              if(deltaX &gt; 0) { onRightToLeftSwipe(); return true; }
                          }
                          else {
                                  String str = "Swipe was only " + Math.abs(deltaX) + " long, need at least " + MIN_DISTANCE;
                                  Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show();
                                  return false; 
                          }
                      break;
                  }
                  return false;
              }
          });
      }
  
  
      private void onRightToLeftSwipe() {
          Toast.makeText(getApplicationContext(), "Right Swipe", Toast.LENGTH_SHORT).show();
      }
  
      private void onLeftToRightSwipe() {
          Toast.makeText(getApplicationContext(), "Left Swipe", Toast.LENGTH_SHORT).show();
      }
  
  
  }
  </code></pre>