Skip to content Skip to sidebar Skip to footer

Android Not Restoring Instance State

I know similar questions have been asked but none of the solutions to those questions have been working for me. When I go ahead and try to save the state of my app, the state of th

Solution 1:

Go to debug mode and see if your onCreate is being called. Do you have android:configChanges set in your manifest?

Solution 2:

You should refer to the key you gave in outState when checking if savedInstanceState is not null, like this.

if (savedInstanceState != null) {
            Stringtext= savedInstanceState.getString("test");
            Log.v(TAG, "Restoring instance state");
        }

This documentation may shed some light

https://developer.android.com/guide/components/activities/activity-lifecycle.html

Post a Comment for "Android Not Restoring Instance State"