Android ViewFlipper is out of control
Posted
by Doug Miller
on Stack Overflow
See other posts from Stack Overflow
or by Doug Miller
Published on 2010-06-07T06:02:13Z
Indexed on
2010/06/07
6:12 UTC
Read the original article
Hit count: 297
android
|viewflipper
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();
}
© Stack Overflow or respective owner