How does Viewflipper handle the back button in Android?

I am thinking of using ViewFlipper for a Wizard such as Activity. But I see one problem with this approach. Back button Will the back button go back to the last action shown, or will the Viewflipper somehow catch the back button event and only go to the last action shown?

I suspect ViewFlipper is seen as one action on the BackStack, so it seems to be the wrong aproach for the wizard. Is it correct?

+6
android viewflipper
source share
2 answers

ViewFlipper is just a view; he does not do special handling of the back button. When you click the back button in an Activity using ViewFlipper, no matter how many times it flips over, you will return from this operation.

+4
source share

@Override public void onBackPressed () {

int displayedChild = viewFlipper.getDisplayedChild(); if (displayedChild>0) { viewFlipper.setDisplayedChild(displayedChild-1); } else{ super.onBackPressed(); } } 
+1
source share

All Articles