title: swipe to another activity(Intent doesnt work)
body: <p>Main.java</p>
  
  <pre><code>public class Main extends Activity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      View v = findViewById(R.id.main);
      v.setOnTouchListener(new OnSwipeTouchListener(this) {
          public void onSwipeTop() {
              Toast.makeText(Main.this, "top", Toast.LENGTH_SHORT).show();
          }
          public void onSwipeRight() {
              Intent i = new Intent(Main.this, Rev.class);
              startActivity(i);
              overridePendingTransition(R.anim.inl, R.anim.outl);
          }
          public void onSwipeLeft() {
              Toast.makeText(Main.this, "left", Toast.LENGTH_SHORT).show();
          }
          public void onSwipeBottom() {
              Toast.makeText(Main.this, "bottom", Toast.LENGTH_SHORT).show();
          }
  
          @Override
          public boolean onTouch(View v, MotionEvent event) {
              // TODO Auto-generated method stub
                return gestureDetector.onTouchEvent(event);
          }
      });
  
  };
  </code></pre>
  
  <p>OnSwipeTouchListener.java</p>
  
  <pre><code>public abstract class OnSwipeTouchListener implements OnTouchListener {
  
  protected final GestureDetector gestureDetector;
  
  public OnSwipeTouchListener (Context ctx){
      gestureDetector = new GestureDetector(ctx, new GestureListener());
  }
  
  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();
                      }
                  }
                  result = true;
              } 
              else if (Math.abs(diffY) &gt; SWIPE_THRESHOLD &amp;&amp; Math.abs(velocityY) &gt; SWIPE_VELOCITY_THRESHOLD) {
                      if (diffY &gt; 0) {
                          onSwipeBottom();
                      } else {
                          onSwipeTop();
                      }
                  }
                  result = true;
  
          } catch (Exception exception) {
              exception.printStackTrace();
          }
          return result;
      }
  }
  
  public void onSwipeRight() {
  
  }
  
  public void onSwipeLeft() {
  }
  
  public void onSwipeTop() {
  }
  
  public void onSwipeBottom() {
  }
  </code></pre>
  
  <p>;</p>
  
  <p>main.xml</p>
  
  <pre><code>&lt;View xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:gravity="fill"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="com.joker.charsoo.Main"
  android:background="@drawable/glass"
  android:id="@+id/main" &gt;
  </code></pre>
  
  <p></p>
  
  <p>I have a weired problem! When i swipe to right nothing happens but Im getting toast for another directions...
  a little help please.</p>
  
  <p>Thank you.</p>