多个Activity生命周期函数的调用

多个Activity生命周期函数的调用_第1张图片

两个Activity:MainActivityotherActivity生命周期函数的调用:

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();

你可能感兴趣的:(多个Activity生命周期函数的调用)