How to remove the entire fragment when the activity is destroyed

Do you know how I can clear all fragments in activity, in layout and in backstack.

I know that we can clear the backstack using:

FragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);

But what about the layout, which I dynamically added to the layout.

+5
source share
2 answers

How to remove the entire fragment when the activity is destroyed

All fragments are automatically destroyed when the activity destroying them is destroyed.

+4
source

You do not need to worry. After the activity is destroyed, all fragments will also be destroyed.

0
source

All Articles