Search code examples
androidviewflipper

How can I programmatically display a ViewFlipper's second child?


I have a ViewFlipper with 3 children.

I want to be able to display any of these children initially. So for example, maybe I want the ViewFlipper to load initially with the 2nd child and not the 1st.

EDIT: I know I can use the getChildAt(int index) method.

When a child in a ViewFlipper is shown, how can I get that child's index?


Solution

  • I want to be able to display any of these children initially. So for example, maybe I want the ViewFlipper to load initially with the 2nd child and not the 1st.

    Call setDisplayedChild().

    When a child in a ViewFlipper is shown, how can I get that child's index?

    Call getDisplayedChild().