I am developing an application in which I am using a ViewFlipper with a custom OnTouch implementation. In the ViewFlipper, I have about 2
Set an AnimationListener on the Viewflipper and then stop the animation when you reach the last slide.
viewFlipper = (ViewFlipper) findViewById(R.id.viewFlipperMain);
viewFlipper.setInAnimation(AnimationUtils.loadAnimation(this,R.anim.slide_in_right));
viewFlipper.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_left));
AnimationListener mAnimationListener = new Animation.AnimationListener() {
public void onAnimationStart(Animation animation) {
//animation started event
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationEnd(Animation animation) {
//TODO animation stopped event
if (viewFlipper.getDisplayedChild()==intLastChild){
viewFlipper.stopFlipping();
}
}
};
//Get a reference to one of the animations set on the ViewFlipper
//In this example, I used the "In Animation"
viewFlipper.getInAnimation().setAnimationListener(mAnimationListener);