Thursday, May 11, 2023

Android FragmentStateManager.createView IllegalArgumentException: No view found for id

I had this exception when replacing a fragment inside another fragment in a transaction where getParentFragmentManager() was called.

The solution was calling getChildFragmentManager():

Return a private FragmentManager for placing and managing Fragments inside of this Fragment.

Thanks to flodaniel here and Malachiasz here.