Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
324 views
in Technique[技术] by (71.8m points)

android - State of Activity while in onActivityResult question

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)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...