开发者

State of Activity while in onActivityResult question

开发者 https://www.devze.com 2023-02-12 19:14 出处:网络
I have a question about the Activity\'s state while in onActivityResult.Specifically, is it \'guaranteed\' that either onRestoreInstanceState 开发者_如何学运维or onCreate have been called prior to onA

I have a question about the Activity's state while in onActivityResult. Specifically, is it 'guaranteed' that either onRestoreInstanceState 开发者_如何学运维or onCreate have been called prior to onActivityResult for an Activity? In other words, is it safe to assume that the state data (member variables and such) of the Activity are 'usable' while in onActivityResult (assuming you have properly handled onRestoreInstanceState and or onCreate)?


In my app I get the following workflow:

onCreate
onStart
onRestoreInstanceState
onActivityResult
onResume

So, yes onActivityResult is called AFTER the onRestoreInstanceState, so you can count on the state has been fully restored (unless you do smth in onResume).


An activity which launches another activity with startActivityForResult is fully active, just it has lost the focus - i.e it does not recieve touch input. If you would launch a transparent activity with this method you could see that the first activity is still doing its animations etc in the background.

0

精彩评论

暂无评论...
验证码 换一张
取 消