Jim
Jim

Reputation: 19572

How to hide inner fragments?

I have been reading that to hide a fragment the recommended way is to do it from the parent activity using the fragment transaction.
But if we have:
ActivityA --> Fragment1
And Fragment1 has inner fragments using the getChildFragmentManager.
How should I remove the inner fragments? Trying from ActivityA I am getting null when trying to do findFragmentByTag.
Should I be doing it from Fragment1?

Upvotes: 0

Views: 42

Answers (1)

Gennadii Saprykin
Gennadii Saprykin

Reputation: 4573

Yes. Since Fragment1 is a "parent" of inner fragments, it is responsible for them. You can perform transactions on its child fragments via child fragment manager.

Upvotes: 1

Related Questions