Issue
Quick question: In some cases, an activity will need to be destroyed to free up resources. In that scenario, when the user navigates back to said activity, onCreate() will first be called. I'm asking if onRestoreInstanceState() will still be called if ever that happens.
Solution
Yes, it will.
First onCreate()
is called with the saved instance state as a bundle. Then onStart()
is called. Then onRestoreInstanceState()
is called with the same bundle that was passed to onCreate()
.
This gives you the option to restore the state either in onCreate()
or in onRestoreInstanceState()
.
Answered By - David Wasser
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.