I have added a fragment in another fragment in this way
Secondfragment secondFragment=new SecondFragment(parmater);
fragmentManager.beginTransaction()
.replace(fragmentContainerView.getId(),
secondFragment, null)
.setReorderingAllowed(true)
.commit();
the firstFragment is containing the fragmentContainerView and it's inside a ViewPager2 with other fragments after changing the page and return to it again the app is crashes and give me the error Unable to instantiate fragment , as I mentioned this because the firstFragment have a parameter in constructor . I use this way in multiple places .
after changing the page the first fragment is been in the onPause state and after I go to the first fragment again its recreate the views and the proplen happen here , it cannot instantiate the second fragment.
I want a way to let it instantiate it again ,or any better idea and thank you in advance .