Is there any particular behavior of Activity Lifecycle on Nexus 5?
Problem
I have one Activity, and several Fragment are called like below:
FragmentManager fragmentManager = attachedActivity.getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.activity_initial_setting, switchFragment);
fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
fragmentTransaction.addToBackStack(null);
- every time Fragment is replaced
- and
addToBackStack(null)
is called - each fragment behaves like pagination app
The problem is, for example you are in the 3rd fragment and click home button, and then re-open the app, the display forcibly go back to the first Activity, only on Nexus 5. And, I do not know how to debug or how to trace the behaviour.
Therefore,
- would you tell me if you know the possible reason behind the above problem
- or the general way how to debug if you encounter a weired behaviour of lifecycle along with home button
Speculation
I've read this discussion and noticed that when the home button is clicked, onPause()
is called, and then I re-open the app onRestart()
is called. But I do not know how to go to the next step.