I'm having many crashing issues when programmatically adding 3 levels of nested fragments. Currently, I have an Activity which loads Fragment A through its fragmentManager, which then loads Fragment B through A's childFragmentManager, which then loads Fragment C from B's childFragmentManager.
The fragments initially load up fine. But the problem is when the fragments are destroyed and then re-created. You'd think that when Fragment B gets destroyed, so will Fragment C. But it seems like Fragment C is left dangling.
As it is now, Fragment B gets loaded through a ViewPager in Fragment A. As I swipe from page to page, I occasionally get the following error:
java.lang.IllegalStateException: Fragement no longer exists for key android:target_state: index 1
If I remove fragment C from the equation, the error goes away. It also doesn't crash if I load all fragments in their parent's fragmentManager (instead of childFragmentManager)
The answer is absolutely yes. You can have 3 levels. using it successfully in my App.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With