• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps re-use tabhost

Hi,

I am using a tabhost to show my tabs in a fragment.
Currently I have three fragments where I want to show tabs.

Each fragment shows the tab header correctly but it goes wrong with the content of the tab.
For the first fragment with tabs I open the content for each tab is shown correctly.
However when I change to another fragment it seems that it doesn't properly update the tab specs.
And the tab stays either empty or shows tab content of an old tab.

My way of re-using the tabhost is the following:


Code:
    mTabHost = (TabHost) v.findViewById(android.R.id.tabhost);
        mTabHost.setup();
        mTabHost.setCurrentTab(0);
        mTabHost.clearAllTabs();

        mViewPager = (ViewPager) v.findViewById(R.id.pager);
        mTabsAdapter = new TabsAdapter(getActivity(), mTabHost, mViewPager);

        // Here we load the content for each tab.
        mTabsAdapter.addTab(mTabHost.newTabSpec("tab_1").setIndicator("Featured"), FeaturedTab.class, null);
        mTabsAdapter.addTab(mTabHost.newTabSpec("tab_2").setIndicator("JIO Quest"), JioquestTab.class, null);
        mTabsAdapter.addTab(mTabHost.newTabSpec("tab_3").setIndicator("Public JIO"), PublicjioTab.class, null);
Any one have a pointer on what I am doing wrong?
 
Back
Top Bottom