title: Swipe Activity with smooth animation
body: <p>I am trying to solve this problem...</p>
  
  <p>Structure is-</p>
  
  <pre><code>[1]&lt;----&gt;[2]&lt;--------&gt;[3]&lt;--------&gt;[4]
  </code></pre>
  
  <p>Where [ ]=Activity...(Need-smooth animation with swipe view)<br>
  what I don't need -----> blinks and Backward Stacks while press back on Android device...</p>
  
  <p>Activity 1 swipes for 2 and further 3 for 4 but it gives a blink instead of swipe...</p>
  
  <p>Here is the code...</p>
  
  <pre><code>  public ActivitySwipeDetector(SwipeInterface activity){
      this.activity = activity;
  }
  
  public void onRightToLeftSwipe(View v){
      Log.i(logTag, "RightToLeftSwipe!");
      activity.right2left(v);
  }
  
  public void onLeftToRightSwipe(View v){
      Log.i(logTag, "LeftToRightSwipe!");
      activity.left2right(v);
  }
  
  public void onTopToBottomSwipe(View v){
      Log.i(logTag, "onTopToBottomSwipe!");
      activity.top2bottom(v);
  }
  
  public void onBottomToTopSwipe(View v){
      Log.i(logTag, "onBottomToTopSwipe!");
      activity.bottom2top(v);
  }
  
  public boolean onTouch(View v, MotionEvent event) {
      switch(event.getAction()){
      case MotionEvent.ACTION_DOWN: {
          downX = event.getX();
          downY = event.getY();
          return true;
      }
      case MotionEvent.ACTION_UP: {
          upX = event.getX();
          upY = event.getY();
  
          float deltaX = downX - upX;
          float deltaY = downY - upY;
  
          // swipe horizontal?
          if(Math.abs(deltaX) &gt; MIN_DISTANCE){
              // left or right
              if(deltaX &lt; 0) { this.onLeftToRightSwipe(v); return true; }
              if(deltaX &gt; 0) { this.onRightToLeftSwipe(v); return true; }
          }
          else {
              Log.i(logTag, "Swipe was only " + Math.abs(deltaX) + " long, need at least " + MIN_DISTANCE);
          }
  
          // swipe vertical?
          if(Math.abs(deltaY) &gt; MIN_DISTANCE){
              // top or down
              if(deltaY &lt; 0) { this.onTopToBottomSwipe(v); return true; }
              if(deltaY &gt; 0) { this.onBottomToTopSwipe(v); return true; }
          }
          else {
              Log.i(logTag, "Swipe was only " + Math.abs(deltaX) + " long, need at least       " + MIN_DISTANCE);
              v.performClick();
          }
      }
      }
        return false;
    }
  }
  </code></pre>