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
impl Clone for PersistableMode
source§fn clone(&self) -> PersistableMode
fn clone(&self) -> PersistableMode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PersistableMode
impl Debug for PersistableMode
source§impl Default for PersistableMode
impl Default for PersistableMode
source§fn default() -> PersistableMode
fn default() -> PersistableMode
source§impl<'de> Deserialize<'de> for PersistableMode
impl<'de> Deserialize<'de> for PersistableMode
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl PartialEq<PersistableMode> for PersistableMode
impl PartialEq<PersistableMode> for PersistableMode
source§fn eq(&self, other: &PersistableMode) -> bool
fn eq(&self, other: &PersistableMode) -> bool
self
and other
values to be equal, and is used
by ==
.