Reputation: 117
Developing in Android 2.1, I have a ViewFlipper layout with 3 includes and I have tried to explicitly make the program go back one include when pressing the 'Back' button.
@Override
public void onBackPressed() {
switch (backStatus) {
case 0: finish();
case 1: //TODO Check save
case 2: a.animateLeft(Flipper);
case 99: setContentView(R.layout.main);
}
}
I have also tried using the onKeyDown/Up call with the same code.
Obviously backStatus changes when it moves to another include. The problem is, and I'll give one example... on the 3rd ("case 2") include is a list of options that work into include 2. If the user wanted to cancel that and press the back button (to call a.animateLeft(Flipper)) it should go straight back to the 2nd include, but it doesn't. It goes straight back to the 1st include. Furthermore it disables the Click listeners on the buttons so now none of them respond.
Leaving "case 2" out does disable it altogether on that include, which obviously is no good. All the code for animating left and right works fine from on screen buttons and the correct backStatus flag is passed when switching flippers. Does anyone know how I can solve this little pickle?
Thanks in advance, AW.
Upvotes: 0
Views: 297