Condividi tramite


Activity.OnRestoreInstanceState Method

Definition

Overloads

OnRestoreInstanceState(Bundle)

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

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 <var>savedInstanceState</var>.

[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 <var>savedInstanceState</var>. Most implementations will simply use #onCreate 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.

This method is called between #onStart and #onPostCreate. This method is called only when recreating an activity; the method isn't invoked if #onStart is called for any other reason.

Java documentation for android.app.Activity.onRestoreInstanceState(android.os.Bundle).

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 android.R.attr#persistableMode set to persistAcrossReboots. The android.os.PersistableBundle passed came from the restored PersistableBundle first saved in #onSaveInstanceState(Bundle, PersistableBundle).

This method is called between #onStart and #onPostCreate.

If this method is called #onRestoreInstanceState(Bundle) will not be called.

At least one of savedInstanceState or persistentState will not be null.

Java documentation for android.app.Activity.onRestoreInstanceState(android.os.Bundle, android.os.PersistableBundle).

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