Language

Activity.OnRestoreInstanceState Method

Definition

Overloads

Name Description
OnRestoreInstanceState(Bundle)

This method is called after #onStart when the activity is being re-initialized from a previously saved state, given here in savedInstanceState.

OnRestoreInstanceState(Bundle, PersistableBundle)

This is the same as #onRestoreInstanceState(Bundle) but is called for activities created with the attribute android.R.attr#persistableMode set to persistAcrossReboots.

OnRestoreInstanceState(Bundle)

This method is called after #onStart when the activity is being re-initialized from a previously saved state, given here in savedInstanceState.

[Android.Runtime.Register("onRestoreInstanceState", "(Landroid/os/Bundle;)V", "GetOnRestoreInstanceState_Landroid_os_Bundle_Handler")]
protected virtual void OnRestoreInstanceState(Android.OS.Bundle savedInstanceState);
[<Android.Runtime.Register("onRestoreInstanceState", "(Landroid/os/Bundle;)V", "GetOnRestoreInstanceState_Landroid_os_Bundle_Handler")>]
abstract member OnRestoreInstanceState : Android.OS.Bundle -> unit
override this.OnRestoreInstanceState : Android.OS.Bundle -> unit

Parameters

savedInstanceState
Bundle

the data most recently supplied in #onSaveInstanceState.

Attributes

Remarks

This method is called after onStart() when the activity is being re-initialized from a previously saved state, given here in savedInstanceState. Most implementations will simply use onCreate(Bundle) to restore their state, but it is sometimes convenient to do it here after all of the initialization has been done or to allow subclasses to decide whether to use your default implementation. The default implementation of this method performs a restore of any view state that had previously been frozen by onSaveInstanceState(Bundle). This method is called between onStart() and onPostCreate(Bundle). This method is called only when recreating an activity; the method isn't invoked if onStart() is called for any other reason.

Android reference for android.app.Activity.onRestoreInstanceState.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to

OnRestoreInstanceState(Bundle, PersistableBundle)

This is the same as #onRestoreInstanceState(Bundle) but is called for activities created with the attribute android.R.attr#persistableMode set to persistAcrossReboots.

[Android.Runtime.Register("onRestoreInstanceState", "(Landroid/os/Bundle;Landroid/os/PersistableBundle;)V", "GetOnRestoreInstanceState_Landroid_os_Bundle_Landroid_os_PersistableBundle_Handler")]
public virtual void OnRestoreInstanceState(Android.OS.Bundle? savedInstanceState, Android.OS.PersistableBundle? persistentState);
[<Android.Runtime.Register("onRestoreInstanceState", "(Landroid/os/Bundle;Landroid/os/PersistableBundle;)V", "GetOnRestoreInstanceState_Landroid_os_Bundle_Landroid_os_PersistableBundle_Handler")>]
abstract member OnRestoreInstanceState : Android.OS.Bundle * Android.OS.PersistableBundle -> unit
override this.OnRestoreInstanceState : Android.OS.Bundle * Android.OS.PersistableBundle -> unit

Parameters

savedInstanceState
Bundle

the data most recently supplied in #onSaveInstanceState or null.

persistentState
PersistableBundle

the data most recently supplied in #onSaveInstanceState or null.

Attributes

Remarks

This is the same as onRestoreInstanceState(Bundle) but is called for activities created with the attribute R.attr.persistableMode set to persistAcrossReboots. The PersistableBundle passed came from the restored PersistableBundle first saved in onSaveInstanceState(Bundle,PersistableBundle). This method is called between onStart() and onPostCreate(Bundle). The system calls this method instead of onRestoreInstanceState(Bundle). The base implementation calls onRestoreInstanceState(Bundle) when savedInstanceState is not null. At least one of savedInstanceState or persistentState will not be null.

Android reference for android.app.Activity.onRestoreInstanceState.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to