views:

55

answers:

0

Hi, I'm currently writing an application which builds the UI dynamially from the server;i.e a template file is loaded and from it Tabs containing ListViews are created. When a user selects an item in the list, another view is to be shown, with the possibility of a back button. It makes good sense to use the ViewFlipper I'm guessing. The application is running/built fine upto the point I have to add the ListView and the child(ViewText and ViewField) into the ViewFlipper considering it is a dynamic process where items are build at runtime. Some code snippets:

private TabSpec createTabs(TabHost mTab, final MainParent mainparent) {
    return mTab.newTabSpec(mainparent.Name()).setIndicator(
            mainparent.getName()).setContent(
            new TabContentFactory() {
                @Override
                public View createTabContent(String tag) {

                    CategoryView v = new ObservationView();
                    ActualView act=new ActualView();

                    ViewFlipper views=new ViewFlipper(this);
                    views.addView(v.MyView(this, tag,
                            mainparent.getCategories()));
                    views.addView(act.MyView(this, tag, v.getActualViews()));

                    views.setFlipInterval(2000);
                    views.startFlipping();

                    return views;
                }

            });
}

The CategoryView and ActualViews are an implementation of the efficient ListView, using a ViewHolder pattern, and they each return a ListView. Maybe I'm missing something but could the ViewFlipper be used in this scenarion? Thanks in advance.