[英]Android access onRestoreInstanceState from onRestart
I am creating an android app with a timer. 我正在创建一个带有计时器的android应用。
When I change orientation, onSavedInstanceState
and onRestoreInstanceState
are called, which is great. 当我更改方向时,将调用
onSavedInstanceState
和onRestoreInstanceState
,这很棒。 However when I press the home button only onSavedInstanceState
is called, but onRestoreInstanceState
is not called. 但是,当我按下主页按钮时,仅
onSavedInstanceState
,而没有调用onRestoreInstanceState
。
Can I access the saved variables from onRestart
or perhaps call onRestoreInstanceState
manually, but I don't know how? 我可以从
onRestart
访问保存的变量,还是可以手动调用onRestoreInstanceState
,但是我不知道怎么办?
You do not see onRestoreInstanceState()
called because Android is not restoring you at that moment. 您不会看到
onRestoreInstanceState()
被调用,因为此时Android尚未还原您。 You pressed home, so launcher app should be brought to front 您按下了主页,因此启动器应用程序应该放在最前面
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.