0

我已经使用 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()?我不能让它这样做。我该如何阻止它这样做?

4

0 回答 0