While adding a new fragment in a back-stack from preference fragment, the Preference fragment life-cycle events onPause() & onResume() is not getting called, when a new fragment is added on top of it.
Due to this, I am not able to update the summary of the item view in the settings fragment.
This code adds the detail fragment on top of settings preference fragment
getSupportFragmentManager().beginTransaction()
.add(R.id.settings_container, new SettingsDetailFragment(), "SettingsDetailFragment")
.commit();
This code handles the backPress
if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
this.finish();
} else {
setToolbarTitle("Settings");
getSupportFragmentManager().popBackStack();
}