You are using ViewFlipper to swipe left and right between views. You should really use ViewPager for that.
That been said, you can do what you want with view flipper if you change your ACTION_UP
to something like:
case MotionEvent.ACTION_UP: {
float currentX = touchevent.getX();
if (lastX > currentX) {
if (viewFlipper.getDisplayedChild() == 2)
break;
// anim stuff here...
viewFlipper.showNext();
}
if (lastX < currentX) {
if (viewFlipper.getDisplayedChild() == 0)
break;
// anim stuff here...
viewFlipper.showPrevious();
}
break;
}