I have an app with child fragments nested inside another fragment using AppCompatActivity. The child fragment is created as follows:
FragmentManager fragmentManager = getChildFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
SeriesFragment seriesFragment =SeriesFragment.newInstance();
fragmentTransaction.replace(container.getId(), seriesFragment);
fragmentTransaction.addToBackStack("seriesFragment");
fragmentTransaction.commit();
The onBackPressed method in the activity is not triggered only when the child fragment is displayed. The app just exits instead of returning to the previous screen. No idea why. Any help is greatly appreciated.