I have a Fragment that has a FrameLayout. This first fragment (A) loads inside its Framelayout another fragment (B). When I call getParentFra
I faced the same issue , and fixed the issues by hosting second fragment in your parent fragment with getChildFragmentManager() then you wont be getting the null value ...
Parent fragment
SignUpFragment signUpFragment = new SignUpFragment();
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.contentPanel, signUpFragment)
.addToBackStack(null).commit();
Child fragment : what i have used is a dialog
HospitalCardDialog hospitalCardDialog = new HospitalCardDialog();
hospitalCardDialog.show(getChildFragmentManager(), "");