Skip to content Skip to sidebar Skip to footer

Can An Activity Be Created With Saved Instance State Saved By An Older Version Of The App?

Could the savedInstanceState parameter passed to Activity.onCreate have been saved by a different version of the app? I can't find any reference to this in the documentation. This

Solution 1:

No. SavedInstanceState is not used to persist data across new instances of the same app. It is used to temporarily store data during the current app's 'session'.

In other words, the values you supply to the savedInstanceState bundle are stored when your activity is destroyed, for example, when you rotate the screen. These values are then retrieved when the activity is recreated.

When you quit the app entirely, or install a new version, these values are lost.


Solution 2:

Theoretically always. Before you upgrade (change) application. It deactivated and later starts over. Now Android Studio added functionality "Instant Run", and in this case may possibly occur such an exception. More I do not have any ideas. It seems to me that such a check is not necessary right now. For all the time my development I've never encountered similar cases and have not heard about such an.


Post a Comment for "Can An Activity Be Created With Saved Instance State Saved By An Older Version Of The App?"