pub enum PersistableMode {
    PersistRootOnly,
    PersistAcrossReboots,
    PersistNever,
}
Expand description

Defines how an instance of an activity is preserved within a containing task across device restarts.

Variants

PersistRootOnly

Default value. When the system restarts, the activity task is preserved, but only the root activity’s launching intent is used.

When your app’s launching intent loads your app’s root activity, the activity doesn’t receive a PersistableBundle object. Therefore, don’t use onSaveInstanceState() to preserve the state of your app’s root activity across a device restart.

Note

This attribute value affects your app’s behavior only if it’s set on your app’s root activity.

PersistAcrossReboots

This activity’s state is preserved, along with the state of each activity higher up the back stack that has its own persistableMode attribute set to persistAcrossReboots. If an activity doesn’t have a persistableMode attribute that is set to persistAcrossReboots, or if it’s launched using the Intent.FLAG_ACTIVITY_NEW_DOCUMENT flag, then that activity, along with all activities higher up the back stack, aren’t preserved.

When an intent loads an activity whose persistableMode attribute is set to persistAcrossReboots in your app, the activity receives a PersistableBundle object in its onCreate() method. Therefore, you can use onSaveInstanceState() to preserve the state of an activity across a device restart as long as its persistableMode attribute is set to persistAcrossReboots.

Note

This attribute value affects your app’s behavior even if it’s set on an activity other than your app’s root activity

PersistNever

The activity’s state isn’t preserved.

Note

This attribute value affects your app’s behavior only if it’s set on your app’s root activity.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.