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§

source§

impl Clone for PersistableMode

source§

fn clone(&self) -> PersistableMode

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PersistableMode

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for PersistableMode

source§

fn default() -> PersistableMode

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

impl<'de> Deserialize<'de> for PersistableMode

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq<PersistableMode> for PersistableMode

source§

fn eq(&self, other: &PersistableMode) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for PersistableMode

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl YaDeserialize for PersistableMode

source§

fn deserialize<R: Read>(reader: &mut Deserializer<R>) -> Result<Self, String>

source§

impl YaSerialize for PersistableMode

source§

fn serialize<W: Write>(&self, writer: &mut Serializer<W>) -> Result<(), String>

source§

fn serialize_attributes( &self, source_attributes: Vec<OwnedAttribute>, source_namespace: Namespace ) -> Result<(Vec<OwnedAttribute>, Namespace), String>

source§

impl Eq for PersistableMode

source§

impl StructuralEq for PersistableMode

source§

impl StructuralPartialEq for PersistableMode

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,