I am using a single activity and multiple fragments(screenshot attached) within the same activity to provide a seamless navigation. But after implementing the latest toolbar and
When you remove a fragment, there is the method isRemoving()
. It helps to change title back.
@Override
public void onStop() {
super.onStop();
if (isRemoving()) {
// Change your title here
}
}
Suggestion: we have to rely on the default android navigation system. If we use addToBackStack()
for our fragments, in theory we don't have to override onBackPressed() at all.
Core App Quality: https://developer.android.com/distribute/essentials/quality/core.html
I suggest to use activity instead of 'MainActivityDetailFragment' to avoid complication.