Muniu
Muniu

Reputation: 187

Android - Switching between Multiple Views in a ViewFlipper

I have an application using ListView inside Tabs, and i'd like to switch to a separate View(data collection widget) on clicking an item in the List. I'm adding each List's row's children to a ViewFlipper and the items are added at runtime so there is no definite number of views. As such, i would want to navigate/switch to a particular View in the ViewFlipper. Any pointers? Thanks in advance.

Upvotes: 2

Views: 5946

Answers (3)

Muniu
Muniu

Reputation: 187

Thanks guys. I have worked around the ViewFlipper setDisplayedChild() method and it works perfectly in my scenario.

myViews.setDisplayedChild(pos);

pos being the ID of the View I want to switch to.

Upvotes: 3

Anthony M.
Anthony M.

Reputation: 43

I have the same problem, I think we had to put in the viewflipper the current view, and the next view we want to display, and call the method shownext() (or showprevious()).

Upvotes: 0

Pentium10
Pentium10

Reputation: 207828

there is no definite number of views.

Very bad approach to add infinite views for a ViewFlipper. Try to add only one, and when an list item is selected refresh the only view and bring it up.

Upvotes: 2

Related Questions