Issue
If I do not explicitly call onSaveInstanceState(), which are possibilities, when savedInstanceState is not null in onCreate?
I see one option, when system recreates my app after crash - then savedInstanceState is not null.
Which are other options?
Solution
Which are possibilities, when savedInstanceState is not null in onCreate()?
- System was on shortage of memory, so it killed the process of your app. User navigates to your app, now
onCreate()will be called with non-nullBundle. - After configuration change (e.g. orientation change) -
onCreate()will be called with non-nullBundle.
If I do not explicitly call onSaveInstanceState()
You shouldn't do that on your own. It's the system that will call activity lifecycle methods and onSavedInstanceState/onRestoreInstanceState.
Answered By - azizbekian
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.