[英]When onRestoreInstanceState is not called?
Docs describes when onRestoreInstanceState
IS called: 文档描述了
onRestoreInstanceState
被调用:
This method is called after
onStart()
when the activity is being re-initialized from a previously saved state, given here in savedInstanceState.当活动从先前保存的状态重新初始化时,在
onStart()
之后onStart()
此方法,此处在savedInstanceState 中给出。 (...) This method is called betweenonStart()
andonPostCreate(Bundle)
.(...) 这个方法在
onStart()
和onPostCreate(Bundle)
之间onStart()
。 This method is called only when recreating an activity;此方法仅在重新创建活动时调用; the method isn't invoked if
onStart()
is called for any other reason .如果出于任何其他原因调用
onStart()
则不会调用该方法。
I'm super curious what does " onStart()
is called for any other reason " mean in context of onRestoreInstanceState
?我非常好奇在
onRestoreInstanceState
上下文中,“出于任何其他原因调用onStart()
是什么意思?
The normal lifecycle of an Activity
looks like this: Activity
的正常生命周期如下所示:
The lifecycle callbacks between onStart()
and onStop()
can occur over and over again if the Activity
is completely obscured by another Activity
.如果
Activity
完全被另一个Activity
遮挡,则onStart()
和onStop()
之间的生命周期回调可能会一遍又一遍地发生。 In this case, onStop()
is called when the Activity
is completely obscured by another Activity
.在这种情况下,当
Activity
被另一个Activity
完全遮挡时,将调用onStop()
。 When the Activity
is made visible again, onStart()
will be called without onRestoreInstanceState()
being called because the Activity
is not being recreated.当
Activity
再次可见时, onStart()
将被调用,而onRestoreInstanceState()
不会被调用,因为Activity
没有被重新创建。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.