Kim Kim - 8 months ago 56
Android Question

In FragmentTabhost, the fragment can`t destory which called by beginTransaction().replace

My fragmentTabhost include 4

in the FragmentTabhost .

In FragmentA, I use the code:

getSupportFragmentManager().beginTransaction().replace(, Fragment_a1).commitAllowingStateLoss();

to jump to the Fragment_a1(not in the tabhost).

But I found a bug when switching the fragment.Such like this order:

When switch to the FragmentA after this order,the screen shows the Fragment_a1 (It should show the FragmentA). Printing the logcat I found the Fragment_a1 can`t be destoryed when switch to FragmentB.

Please give me a hand .Thanks!

Kim Kim

Now I have another method to solve this problem after reading the answer @ How to make particular tab in FragmentTabHost has multiple fragment navigations like tabgroupactivity