0

I have 3 tabs , the tabs created by this codes:

  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    mTabHost = new FragmentTabHost(getActivity());
    mTabHost.setup(getActivity(), getChildFragmentManager(), R.layout.tab);

    mTabHost.addTab(mTabHost.newTabSpec("TabA").setIndicator("tab1"),
            ItemFragment.class, null);
    mTabHost.addTab(mTabHost.newTabSpec("TabB").setIndicator("tab2"),
            TrailerFragment.class, null);
    mTabHost.addTab(mTabHost.newTabSpec("TabC").setIndicator("tab3"),
            PicFragment.class, null);

    mTabHost.addta
    mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        @Override
        public void onTabChanged(String s) {

        }
    });
    return mTabHost;

}

in the first tab I'm getting some data from web , when I select the second tab then the first tab the data loading again , How to fix that?

Samad
  • 1,776
  • 2
  • 20
  • 35
  • Possible duplicate of : http://stackoverflow.com/questions/29190263/avoid-recreating-tabs-ontabchnage-of-fragmenttabhost-in-android – Payal Apr 28 '15 at 09:49
  • what does the fragment do in it's lifecycle overrides (Supposing ItemFragment is an android Fragment thing...). As you didn't show us any code of that fragments, we're up to guessing here. To debug this, try setting breakpoints at the code location where the download starts, then you'll might get a clue. – Bondax Apr 28 '15 at 10:22

0 Answers0