blob: 9917393fe7f7fc74d51963c6cfc2ceded2ea47e9 [file] [log] [blame]
<html devsite="true">
<head>
<title>Lifecycle.State</title>
{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div id="metadata-info-block"></div>
<h1>Lifecycle.State</h1>
<p>
<pre>enum <a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a></pre>
</p>
<hr>
<p>Lifecycle states. You can consider the states as the nodes in a graph and <code><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.Event.html">Event</a></code>s as the edges between these nodes.</p>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%"><h3>Enum Values</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#CREATED">CREATED</a></code></td>
<td>
<p>Created state for a LifecycleOwner.</p>
</td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#DESTROYED">DESTROYED</a></code></td>
<td>
<p>Destroyed state for a LifecycleOwner.</p>
</td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#INITIALIZED">INITIALIZED</a></code></td>
<td>
<p>Initialized state for a LifecycleOwner.</p>
</td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#RESUMED">RESUMED</a></code></td>
<td>
<p>Resumed state for a LifecycleOwner.</p>
</td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#STARTED">STARTED</a></code></td>
<td>
<p>Started state for a LifecycleOwner.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#State()">State</a>()</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%"><h3>Public functions</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#isAtLeast(androidx.lifecycle.Lifecycle.State)">isAtLeast</a>(state:&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a>)</code></div>
<p>Compares if this State is greater or equal to the given <code>state</code>.</p>
</td>
</tr>
<tr>
<td width="40%"><code>java-static <a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a>!</code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#valueOf(java.lang.String)">valueOf</a>(name:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>!)</code></div>
<p>Returns the enum constant of this type with the specified name.</p>
</td>
</tr>
<tr>
<td width="40%"><code>java-static <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a>!&gt;!</code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#values()">values</a>()</code></div>
<p>Returns an array containing the constants of this enum type, in the order they're declared.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Enum Values</h2>
<div>
<h3 class="api-name" id="CREATED">CREATED</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#CREATED">Lifecycle.State.CREATED</a>:&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a></pre>
<p>Created state for a LifecycleOwner. For an <code><a href="https://developer.android.com/reference/android/app/Activity.html">android.app.Activity</a></code>, this state is reached in two cases: </p>
<ul>
<li>after <code><a href="https://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)">onCreate</a></code> call; </li>
<li><b>right before</b><code><a href="https://developer.android.com/reference/android/app/Activity.html#onStop()">onStop</a></code> call. </li>
</ul>
</div>
<div>
<h3 class="api-name" id="DESTROYED">DESTROYED</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#DESTROYED">Lifecycle.State.DESTROYED</a>:&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a></pre>
<p>Destroyed state for a LifecycleOwner. After this event, this Lifecycle will not dispatch any more events. For instance, for an <code><a href="https://developer.android.com/reference/android/app/Activity.html">android.app.Activity</a></code>, this state is reached <b>right before</b> Activity's <code><a href="https://developer.android.com/reference/android/app/Activity.html#onDestroy()">onDestroy</a></code> call.</p>
</div>
<div>
<h3 class="api-name" id="INITIALIZED">INITIALIZED</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#INITIALIZED">Lifecycle.State.INITIALIZED</a>:&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a></pre>
<p>Initialized state for a LifecycleOwner. For an <code><a href="https://developer.android.com/reference/android/app/Activity.html">android.app.Activity</a></code>, this is the state when it is constructed but has not received <code><a href="https://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)">onCreate</a></code> yet.</p>
</div>
<div>
<h3 class="api-name" id="RESUMED">RESUMED</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#RESUMED">Lifecycle.State.RESUMED</a>:&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a></pre>
<p>Resumed state for a LifecycleOwner. For an <code><a href="https://developer.android.com/reference/android/app/Activity.html">android.app.Activity</a></code>, this state is reached after <code><a href="https://developer.android.com/reference/android/app/Activity.html#onResume()">onResume</a></code> is called.</p>
</div>
<div>
<h3 class="api-name" id="STARTED">STARTED</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#STARTED">Lifecycle.State.STARTED</a>:&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a></pre>
<p>Started state for a LifecycleOwner. For an <code><a href="https://developer.android.com/reference/android/app/Activity.html">android.app.Activity</a></code>, this state is reached in two cases: </p>
<ul>
<li>after <code><a href="https://developer.android.com/reference/android/app/Activity.html#onStart()">onStart</a></code> call; </li>
<li><b>right before</b><code><a href="https://developer.android.com/reference/android/app/Activity.html#onPause()">onPause</a></code> call. </li>
</ul>
</div>
<h2>Public constructors</h2>
<div><a name="State--"></a><a name="state"></a>
<h3 class="api-name" id="State()">State</h3>
<pre class="api-signature no-pretty-print"><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#State()">State</a>()</pre>
</div>
<h2>Public functions</h2>
<div><a name="isAtLeast-androidx.lifecycle.Lifecycle.State-"></a><a name="isatleast"></a>
<h3 class="api-name" id="isAtLeast(androidx.lifecycle.Lifecycle.State)">isAtLeast</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#isAtLeast(androidx.lifecycle.Lifecycle.State)">isAtLeast</a>(state:&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Compares if this State is greater or equal to the given <code>state</code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>state:&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a></code></td>
<td>
<p>State to compare with</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<p>true if this State is greater or equal to the given <code>state</code></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="valueOf-java.lang.String-"></a><a name="valueof"></a>
<h3 class="api-name" id="valueOf(java.lang.String)">valueOf</h3>
<pre class="api-signature no-pretty-print">java-static&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#valueOf(java.lang.String)">valueOf</a>(name:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>!):&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a>!</pre>
<p>Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a>!</code></td>
<td>
<p>the enum constant with the specified name</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Throws</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>java.lang.IllegalArgumentException:&nbsp;<a href="https://developer.android.com/reference/java/lang/IllegalArgumentException.html">java.lang.IllegalArgumentException</a></code></td>
<td>
<p>if this enum type has no constant with the specified name</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="values--"></a><a name="values"></a>
<h3 class="api-name" id="values()">values</h3>
<pre class="api-signature no-pretty-print">java-static&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html#values()">values</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a>!&gt;!</pre>
<p>Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="/reference/kotlin/androidx/lifecycle/Lifecycle.State.html">Lifecycle.State</a>!&gt;!</code></td>
<td>
<p>an array containing the constants of this enum type, in the order they're declared</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>