I used this code.
private ViewFlipper vf; private float lastX; case MotionEvent.ACTION_UP: { float currentX = touchevent.getX(); if (lastX < currentX) { vf.setInAnimation(this, R.anim.in_from_left); vf.setOutAnimation(this, R.anim.out_to_right); vf.showNext(); } if (lastX > currentX) { vf.setInAnimation(this, R.anim.in_from_right); vf.setOutAnimation(this, R.anim.out_to_left); vf.showPrevious(); } break; }
source share