Kim Kim - 1 year ago 89
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
Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download