我已经使用startActivityForResult()启动了一个活动,当我在这个新活动上单击主页按钮然后重新打开应用程序时,活动关闭并返回到上一个活动。我已将生命周期方法的默认实现放入并设置断点,并在再次打开应用程序后按顺序执行以下操作:
@Override
protected void onResume() {
super.onResume();
// The activity has become visible (it is now "resumed").
}
@Override
protected void onPause() {
super.onPause();
// Another activity is taking focus (this activity is about to be "paused").
}
@Override
protected void onStop() {
super.onStop();
// The activity is no longer visible (it is now "stopped")
}
@Override
protected void onDestroy() {
super.onDestroy();
// The activity is about to be destroyed.
}
为什么调用onStop()和onDestroy()?我不能这样做。我如何阻止它这样做?