Android ViewFlipper is out of control
- by Doug Miller
I have an app that uses a ViewFlipper to display some text and images. I have the flipper's flipinterval set to 10 seconds, but also want to allow the user to click a button that will advance the flipper. The code blow works great on 2.2, the view is changed every 10 seconds and if I click flip_button the view is changed and the auto flip steps back in 10 seconds later. The 1.5 and 1.6 versions will remember the manual advance and it will happen every time in the rotation. What am I missing?
private void initFlipButton(){
final ImageView flip_button = (ImageView) findViewById(R.id.flip_button);
info_button.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
flipper.stopFlipping();
flipper.showNext();
flipper.startFlipping();
}
});
}
private void initFlipper(){
flipper = (ViewFlipper) findViewById(R.id.flip_dog);
flipper.setFlipInterval(10000);
flipper.setInAnimation(inFromRightAnimation());
flipper.setOutAnimation(outToLeftAnimation());
flipper.startFlipping();
}