Two similar bottom sheets but one needs childFragmentManager and other one parentFragmentManager! Why?

25 Views Asked by At

I accept that I am not master in fragment manager. But I expect that two similar BottomSheets behave similarly.

I have a CustomBottomSheet (extend of BottomSheetDialogFragment). I have created a new instance of that in fragment A and another new instance of that inside of the MyUtility class:


FragmentA

MyUtility mu = new MyUtility(FragmentA.this);

CustomBottomSheet.NewInstance().show(getChildFragmentManager(), null);

And in MyUtility.java


CustomBottomSheet.NewInstance().show(fragment.getChildFragmentManager(), null);

for getting the results of these bottom Sheets first one needs getParentFragmentManager().setFragmentResultListener ... and second one needs getChildFragmentManager().setFragmentResultListener ....

Why do they behave differently?

0

There are 0 best solutions below