I have a FragmentManager
that I am using to add Fragments
onto the backStack
.
FragmentTransaction ft = getFragmentManager().beginTransaction();
PUCCoursesSubjectList detail = new PUCCoursesSubjectList();
detail.item = item;
ft.add(R.id.container_frame, detail, "courses_detail");
ft.addToBackStack(null);
ft.commit();
Once I have a few Fragments
on the stack, I pop one off, but I need to know when the previous fragment is shown again.
It seems that onResume
doesn't apply here. Is there another method that I should be using to know when a Fragment
, that is already in the FragmentManger
, appears?
When you pop your fragment, you could get your other fragment from the fragment manager by the tag you provided and call a public method in your fragment.
YourFragment fragment = (YourFragment) getFragmentManager().findFragmentByTag("FRAGMENT_TAG");
if (fragment != null) {
fragment.callMethod();
}