onSaveInstanceState(Bundle)方法是在onPause()之后调用的吗?

Is the method onSaveInstanceState(Bundle) called after onPause()?

我是 android 的新手,我读了一本面向初学者的书,书中说 onSaveInstanceState(Bundle) 确保在系统回收您的 Activity 之前被调用。 我在一些测试代码上试了一下,发现不正确。我发现每次调用onPause()后都会调用onSaveInstanceState(Bundle)。而且与系统回收无关。 我不是很确定,所以这就是问题:onSaveInstanceState(Bundle) 实际什么时候被调用?

根据Android Documentation

In addition, the method onSaveInstanceState(Bundle) is called before placing the activity in such a background state, allowing you to save away any dynamic instance state in your activity into the given Bundle, to be later received in onCreate(Bundle) if the activity needs to be re-created. See the Process Lifecycle section for more information on how the lifecycle of a process is tied to the activities it is hosting. Note that it is important to save persistent data in onPause() instead of onSaveInstanceState(Bundle) because the latter is not part of the lifecycle callbacks, so will not be called in every situation as described in its documentation.

onPause()onSaveInstanceState(Bundle) 之前调用。但是 onPause() 保证被称为 activity life cycle

的一部分

通常当你的 activity 被重新创建时,例如当你改变设备方向时,如果你没有在你的 [=19= 中指定 android:configChanges 标签,那么 onSaveInstanceState(Bundle) 被调用] 文件。

我不同意之前的回答。
根据 Documentation:

If called, this method will occur before onStop(). There are no guarantees about whether it will occur before or after onPause().