两个Activity:MainActivity和otherActivity生命周期函数的调用:
1.启动MainActivity时:
MainActivity:onCreate(); →MainActivity:onStart(); →MainActivity:onResume();
2.此时启动otherActivity:
MainActivity:onPause(); →otherActivity:onCreate(); →otherActivity:onStart(); →otherActivity:onResume();
→MainActiviy:onStop();
3.此时后退回MainActivity:
otherActivity:onPause(); →MainActivity:onRestart(); →MainActivity:onStart(); →MainActivity:onResume(); →otherActivity:onStop(); →otherActivity:onDestroy();