Activity.OnRestoreInstanceState Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 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
Bundle: the data most recently supplied in onSaveInstanceState(Bundle). This value cannot be null.
- 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.
See also:
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.
Applies to
OnRestoreInstanceState(Bundle, PersistableBundle)
This is the same as onRestoreInstanceState(Bundle) but is called for activities created with the attribute 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
Bundle: the data most recently supplied in onSaveInstanceState(Bundle) or null.
- persistentState
- PersistableBundle
PersistableBundle: the data most recently supplied in onSaveInstanceState(Bundle) 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). If this method is called onRestoreInstanceState(Bundle) will not be called. At least one of savedInstanceState or persistentState will not be null.
See also:
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.