blob: 99cbbbb5524a85e54daa17a6b5905a0fd2a234d3 [file] [log] [blame]
<html devsite="true">
<head>
<title>FragmentManager</title>
{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>FragmentManager</h1>
{% setvar page_path %}androidx/fragment/app/FragmentManager.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_kotlin_switcher2.md" %}
<p>
<pre>abstract class FragmentManager : <a href="/reference/kotlin/androidx/fragment/app/FragmentResultOwner.html">FragmentResultOwner</a></pre>
</p>
<hr>
<p>Static library support version of the framework's android.app.FragmentManager. Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code> documentation for a class overview. </p>
<p>Your activity must derive from <code><a href="/reference/kotlin/androidx/fragment/app/FragmentActivity.html">FragmentActivity</a></code> to use this. From such an activity, you can acquire the <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code> by calling <code><a href="/reference/kotlin/androidx/fragment/app/FragmentActivity.html#getSupportFragmentManager()">FragmentActivity#getSupportFragmentManager</a></code>.</p>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Nested types</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.BackStackEntry.html">FragmentManager.BackStackEntry</a></code></td>
<td width="100%">
<p>Representation of an entry on the fragment back stack, as created with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addToBackStack(java.lang.String)">FragmentTransaction.addToBackStack()</a></code>.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html">FragmentManager.FragmentLifecycleCallbacks</a></code></td>
<td width="100%">
<p>Callback interface for listening to fragment state changes that happen within a given FragmentManager.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.OnBackStackChangedListener.html">FragmentManager.OnBackStackChangedListener</a></code></td>
<td width="100%">
<p>Interface to watch for changes to the back stack.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Constants</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#POP_BACK_STACK_INCLUSIVE()">POP_BACK_STACK_INCLUSIVE</a></code></div>
<p>Flag for <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(java.lang.String,int)">popBackStack</a></code> and <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(int,int)">popBackStack</a></code>: If set, and the name or ID of a back stack entry has been supplied, then all matching entries will be consumed until one that doesn't match is found or the bottom of the stack is reached.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#FragmentManager()">FragmentManager</a>()</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Public functions</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#addFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener)">addFragmentOnAttachListener</a>(listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html">FragmentOnAttachListener</a>)</code></div>
<p>Add a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html">FragmentOnAttachListener</a></code> that should receive a call to <code><a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html#onAttachFragment(androidx.fragment.app.FragmentManager,androidx.fragment.app.Fragment)">FragmentOnAttachListener#onAttachFragment(FragmentManager, Fragment)</a></code> when a new Fragment is attached to this FragmentManager.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#addOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener)">addOnBackStackChangedListener</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.OnBackStackChangedListener.html">FragmentManager.OnBackStackChangedListener</a><br>)</code></div>
<p>Add a new listener for changes to the fragment back stack.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#beginTransaction()">beginTransaction</a>()</code></div>
<p>Start a series of edit operations on the Fragments associated with this FragmentManager.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#clearFragmentResult(java.lang.String)">clearFragmentResult</a>(requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>)</code></div>
<p>Clears the stored result for the given requestKey.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#clearFragmentResultListener(java.lang.String)">clearFragmentResultListener</a>(requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>)</code></div>
<p>Clears the stored <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code> for the given requestKey.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[])">dump</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;prefix:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;fd:&nbsp;<a href="https://developer.android.com/reference/java/io/FileDescriptor.html">FileDescriptor</a>?,<br>&nbsp;&nbsp;&nbsp;&nbsp;writer:&nbsp;<a href="https://developer.android.com/reference/java/io/PrintWriter.html">PrintWriter</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;args:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&gt;?<br>)</code></div>
<p>Print the FragmentManager's state into the given stream.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#enableDebugLogging(boolean)">enableDebugLogging</a></del></span>(enabled:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a>)</code></div>
<p><strong>This function is deprecated.</strong>
<p>FragmentManager now respects Log#isLoggable(String, int) for debug logging, allowing you to use <code>adb shell setprop log.tag.FragmentManager VERBOSE</code>.</p>
</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/kotlin/androidx/fragment/app/FragmentStateManagerControl.html">FragmentStateManagerControl</a>&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#enableNewStateManager(boolean)">enableNewStateManager</a>(enabled:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a>)</code></div>
<p>Control whether FragmentManager uses the new state manager that is responsible for: </p>
<ul>
<li>Moving Fragments through their lifecycle methods</li>
<li>Running animations and transitions</li>
<li>Handling postponed transactions</li>
</ul>
This must only be changed <b>before</b> any fragment transactions are done (i.e., in your <code>Application</code> class or prior to <code>super.onCreate()</code>in every activity with the same value for all activities).</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#executePendingTransactions()">executePendingTransactions</a>()</code></div>
<p>After a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code> is committed with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commit()">FragmentTransaction.commit()</a></code>, it is scheduled to be executed asynchronously on the process's main thread.</p>
</td>
</tr>
<tr>
<td><code>F</code></td>
<td width="100%">
<div><code>&lt;F&nbsp;:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?&gt; <a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#findFragment(android.view.View)">findFragment</a>(view:&nbsp;View)</code></div>
<p>Find a <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a></code> associated with the given View.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#findFragmentById(int)">findFragmentById</a>(id:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Finds a fragment that was identified by the given id either when inflated from XML or as the container ID when added in a transaction.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#findFragmentByTag(java.lang.String)">findFragmentByTag</a>(tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>?)</code></div>
<p>Finds a fragment that was identified by the given tag either when inflated from XML or as supplied when added in a transaction.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.BackStackEntry.html">FragmentManager.BackStackEntry</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getBackStackEntryAt(int)">getBackStackEntryAt</a>(index:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Return the BackStackEntry at index index in the back stack; entries start index 0 being the bottom of the stack.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getBackStackEntryCount()">getBackStackEntryCount</a>()</code></div>
<p>Return the number of entries currently in the back stack.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getFragment(android.os.Bundle,java.lang.String)">getFragment</a>(bundle:&nbsp;Bundle,&nbsp;key:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>)</code></div>
<p>Retrieve the current Fragment instance for a reference previously placed with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#putFragment(android.os.Bundle,java.lang.String,androidx.fragment.app.Fragment)">putFragment</a></code>.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getFragmentFactory()">getFragmentFactory</a>()</code></div>
<p>Gets the current <code><a href="/reference/kotlin/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a></code> used to instantiate new Fragment instances.</p>
</td>
</tr>
<tr>
<td><code><a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getFragments()">getFragments</a>()</code></div>
<p>Get a list of all fragments that are currently added to the FragmentManager.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getPrimaryNavigationFragment()">getPrimaryNavigationFragment</a>()</code></div>
<p>Return the currently active primary navigation fragment for this FragmentManager.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#isDestroyed()">isDestroyed</a>()</code></div>
<p>Returns true if the final Activity.onDestroy() call has been made on the FragmentManager's Activity, so this instance is now dead.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#isStateSaved()">isStateSaved</a>()</code></div>
<p>Returns <code>{@code true}</code> if the FragmentManager's state has already been saved by its host.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack()">popBackStack</a>()</code></div>
<p>Pop the top state off the back stack.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(java.lang.String,int)">popBackStack</a>(name:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>?,&nbsp;flags:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Pop the last fragment transition from the manager's fragment back stack.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(int,int)">popBackStack</a>(id:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;flags:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Pop all back stack states up to the one with the given identifier.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStackImmediate()">popBackStackImmediate</a>()</code></div>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack()">popBackStack</a></code>, but performs the operation immediately inside of the call.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStackImmediate(java.lang.String,int)">popBackStackImmediate</a>(name:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>?,&nbsp;flags:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(java.lang.String,int)">popBackStack</a></code>, but performs the operation immediately inside of the call.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStackImmediate(int,int)">popBackStackImmediate</a>(id:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;flags:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(int,int)">popBackStack</a></code>, but performs the operation immediately inside of the call.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#putFragment(android.os.Bundle,java.lang.String,androidx.fragment.app.Fragment)">putFragment</a>(bundle:&nbsp;Bundle,&nbsp;key:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>,&nbsp;fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>)</code></div>
<p>Put a reference to a fragment in a Bundle.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#registerFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks,boolean)">registerFragmentLifecycleCallbacks</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;cb:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html">FragmentManager.FragmentLifecycleCallbacks</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;recursive:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a><br>)</code></div>
<p>Registers a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html">FragmentLifecycleCallbacks</a></code> to listen to fragment lifecycle events happening in this FragmentManager.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#removeFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener)">removeFragmentOnAttachListener</a>(listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html">FragmentOnAttachListener</a>)</code></div>
<p>Remove a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html">FragmentOnAttachListener</a></code> that was previously added via <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#addFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener)">addFragmentOnAttachListener</a></code>.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#removeOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener)">removeOnBackStackChangedListener</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.OnBackStackChangedListener.html">FragmentManager.OnBackStackChangedListener</a><br>)</code></div>
<p>Remove a listener that was previously added with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#addOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener)">addOnBackStackChangedListener</a></code>.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.SavedState.html">Fragment.SavedState</a>?</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#saveFragmentInstanceState(androidx.fragment.app.Fragment)">saveFragmentInstanceState</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>)</code></div>
<p>Save the current instance state of the given Fragment.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#setFragmentFactory(androidx.fragment.app.FragmentFactory)">setFragmentFactory</a>(fragmentFactory:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a>)</code></div>
<p>Set a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a></code> for this FragmentManager that will be used to create new Fragment instances from this point onward.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#setFragmentResult(java.lang.String,android.os.Bundle)">setFragmentResult</a>(requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>,&nbsp;result:&nbsp;Bundle)</code></div>
<p>Sets the given result for the requestKey.</p>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)">setFragmentResultListener</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;lifecycleOwner:&nbsp;LifecycleOwner,<br>&nbsp;&nbsp;&nbsp;&nbsp;listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a><br>)</code></div>
<p>Sets the <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code> for a given requestKey.</p>
</td>
</tr>
<tr>
<td><code><a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#toString()">toString</a>()</code></div>
</td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#unregisterFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks)">unregisterFragmentLifecycleCallbacks</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;cb:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html">FragmentManager.FragmentLifecycleCallbacks</a><br>)</code></div>
<p>Unregisters a previously registered <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html">FragmentLifecycleCallbacks</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Constants</h2>
<div><a name="getPOP_BACK_STACK_INCLUSIVE()"></a><a name="setPOP_BACK_STACK_INCLUSIVE()"></a><a name="getPOP_BACK_STACK_INCLUSIVE--"></a><a name="setPOP_BACK_STACK_INCLUSIVE--"></a>
<h3 class="api-name" id="POP_BACK_STACK_INCLUSIVE()">POP_BACK_STACK_INCLUSIVE</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#POP_BACK_STACK_INCLUSIVE()">POP_BACK_STACK_INCLUSIVE</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Flag for <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(java.lang.String,int)">popBackStack</a></code> and <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(int,int)">popBackStack</a></code>: If set, and the name or ID of a back stack entry has been supplied, then all matching entries will be consumed until one that doesn't match is found or the bottom of the stack is reached. Otherwise, all entries up to but not including that entry will be removed.</p>
</div>
<h2>Public constructors</h2>
<div><a name="FragmentManager--"></a>
<h3 class="api-name" id="FragmentManager()">FragmentManager</h3>
<pre class="api-signature no-pretty-print"><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#FragmentManager()">FragmentManager</a>()</pre>
</div>
<h2>Public functions</h2>
<div><a name="addFragmentOnAttachListener-androidx.fragment.app.FragmentOnAttachListener-"></a>
<h3 class="api-name" id="addFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener)">addFragmentOnAttachListener</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#addFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener)">addFragmentOnAttachListener</a>(listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html">FragmentOnAttachListener</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Add a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html">FragmentOnAttachListener</a></code> that should receive a call to <code><a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html#onAttachFragment(androidx.fragment.app.FragmentManager,androidx.fragment.app.Fragment)">FragmentOnAttachListener#onAttachFragment(FragmentManager, Fragment)</a></code> when a new Fragment is attached to this FragmentManager.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html">FragmentOnAttachListener</a></code></td>
<td width="100%">
<p>Listener to add</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="addOnBackStackChangedListener-androidx.fragment.app.FragmentManager.OnBackStackChangedListener-"></a>
<h3 class="api-name" id="addOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener)">addOnBackStackChangedListener</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#addOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener)">addOnBackStackChangedListener</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.OnBackStackChangedListener.html">FragmentManager.OnBackStackChangedListener</a><br>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Add a new listener for changes to the fragment back stack.</p>
</div>
<div><a name="beginTransaction--"></a>
<h3 class="api-name" id="beginTransaction()">beginTransaction</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#beginTransaction()">beginTransaction</a>():&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Start a series of edit operations on the Fragments associated with this FragmentManager. </p>
<p>Note: A fragment transaction can only be created/committed prior to an activity saving its state. If you try to commit a transaction after FragmentActivity.onSaveInstanceState() (and prior to a following <code><a href="/reference/kotlin/androidx/fragment/app/FragmentActivity.html#onStart()">FragmentActivity.onStart</a></code> or <code><a href="/reference/kotlin/androidx/fragment/app/FragmentActivity.html#onResume()">FragmentActivity.onResume()</a></code>, you will get an error. This is because the framework takes care of saving your current fragments in the state, and if changes are made after the state is saved then they will be lost.</p>
</div>
<div><a name="clearFragmentResult-java.lang.String-"></a>
<h3 class="api-name" id="clearFragmentResult(java.lang.String)">clearFragmentResult</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#clearFragmentResult(java.lang.String)">clearFragmentResult</a>(requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Clears the stored result for the given requestKey. This clears any result that was previously set via <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultOwner.html#setFragmentResult(java.lang.String,android.os.Bundle)">setFragmentResult</a></code> that hasn't yet been delivered to a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>key used to identify the result</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="clearFragmentResultListener-java.lang.String-"></a>
<h3 class="api-name" id="clearFragmentResultListener(java.lang.String)">clearFragmentResultListener</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#clearFragmentResultListener(java.lang.String)">clearFragmentResultListener</a>(requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Clears the stored <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code> for the given requestKey. This clears any <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code> that was previously set via <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultOwner.html#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)">setFragmentResultListener</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>key used to identify the result</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[])"></a><a name="dump-java.lang.String-java.io.FileDescriptor-java.io.PrintWriter-java.lang.String[]-"></a>
<h3 class="api-name" id="dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[])">dump</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[])">dump</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;prefix:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;fd:&nbsp;<a href="https://developer.android.com/reference/java/io/FileDescriptor.html">FileDescriptor</a>?,<br>&nbsp;&nbsp;&nbsp;&nbsp;writer:&nbsp;<a href="https://developer.android.com/reference/java/io/PrintWriter.html">PrintWriter</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;args:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&gt;?<br>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Print the FragmentManager's state into the given stream.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>prefix:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>Text to print at the front of each line.</p>
</td>
</tr>
<tr>
<td><code>fd:&nbsp;<a href="https://developer.android.com/reference/java/io/FileDescriptor.html">FileDescriptor</a>?</code></td>
<td width="100%">
<p>The raw file descriptor that the dump is being sent to.</p>
</td>
</tr>
<tr>
<td><code>writer:&nbsp;<a href="https://developer.android.com/reference/java/io/PrintWriter.html">PrintWriter</a></code></td>
<td width="100%">
<p>A PrintWriter to which the dump is to be set.</p>
</td>
</tr>
<tr>
<td><code>args:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&gt;?</code></td>
<td width="100%">
<p>Additional arguments to the dump request.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="enableDebugLogging-boolean-"></a>
<h3 class="api-name" id="enableDebugLogging(boolean)">enableDebugLogging</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#enableDebugLogging(boolean)">enableDebugLogging</a></del></span>(enabled:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<aside class="caution"><strong>This function is deprecated.</strong><br>
<p>FragmentManager now respects Log#isLoggable(String, int) for debug logging, allowing you to use <code>adb shell setprop log.tag.FragmentManager VERBOSE</code>.</p>
</aside>
<p>Control whether the framework's internal fragment manager debugging logs are turned on. If enabled, you will see output in logcat as the framework performs fragment operations.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">See also</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/android/util/Log.html#isLoggable(String, int)">Log</a></code></td>
<td width="100%">
<p>android.util.Log#isLoggable(String, int)</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="enableNewStateManager-boolean-"></a>
<h3 class="api-name" id="enableNewStateManager(boolean)">enableNewStateManager</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/androidx/fragment/app/FragmentStateManagerControl.html">FragmentStateManagerControl</a><br>fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#enableNewStateManager(boolean)">enableNewStateManager</a>(enabled:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a>):&nbsp;@<a href="/reference/kotlin/androidx/fragment/app/FragmentStateManagerControl.html">FragmentStateManagerControl</a>&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Control whether FragmentManager uses the new state manager that is responsible for: </p>
<ul>
<li>Moving Fragments through their lifecycle methods</li>
<li>Running animations and transitions</li>
<li>Handling postponed transactions</li>
</ul>
This must only be changed <b>before</b> any fragment transactions are done (i.e., in your <code>Application</code> class or prior to <code>super.onCreate()</code>in every activity with the same value for all activities). Changing it after that point is <b>not</b> supported and can result in fragments not moving to their expected state.
<p>This is <b>enabled</b> by default. Disabling it should only be used in cases where you are debugging a potential regression and as part of <a href="https://issuetracker.google.com/issues/new?component=460964">filing an issue</a> to verify and fix the regression.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>enabled:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<p>Whether the new state manager should be enabled.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="executePendingTransactions--"></a>
<h3 class="api-name" id="executePendingTransactions()">executePendingTransactions</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#executePendingTransactions()">executePendingTransactions</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>After a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code> is committed with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commit()">FragmentTransaction.commit()</a></code>, it is scheduled to be executed asynchronously on the process's main thread. If you want to immediately executing any such pending operations, you can call this function (only from the main thread) to do so. Note that all callbacks and other related behavior will be done from within this call, so be careful about where this is called from. </p>
<p>If you are committing a single transaction that does not modify the fragment back stack, strongly consider using <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commitNow()">FragmentTransaction#commitNow()</a></code> instead. This can help avoid unwanted side effects when other code in your app has pending committed transactions that expect different timing.</p>
<p>This also forces the start of any postponed Transactions where <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html#postponeEnterTransition()">Fragment#postponeEnterTransition()</a></code> has been called.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<p>Returns true if there were any pending transactions to be executed.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="findFragment-android.view.View-"></a>
<h3 class="api-name" id="findFragment(android.view.View)">findFragment</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;&lt;F&nbsp;:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?&gt; <a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#findFragment(android.view.View)">findFragment</a>(view:&nbsp;View):&nbsp;F</pre>
<p>Find a <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a></code> associated with the given View. This method will locate the <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a></code> associated with this view. This is automatically populated for the View returned by <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">Fragment#onCreateView</a></code> and its children.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>F</code></td>
<td width="100%">
<p>the locally scoped <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a></code> to the given view</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>view:&nbsp;View</code></td>
<td width="100%">
<p>the view to search from</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Throws</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>java.lang.IllegalStateException</code></td>
<td width="100%">
<p>if the given view does not correspond with a <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="findFragmentById-int-"></a>
<h3 class="api-name" id="findFragmentById(int)">findFragmentById</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#findFragmentById(int)">findFragmentById</a>(id:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</pre>
<p>Finds a fragment that was identified by the given id either when inflated from XML or as the container ID when added in a transaction. This first searches through fragments that are currently added to the manager's activity; if no such fragment is found, then all fragments currently on the back stack associated with this ID are searched.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</code></td>
<td width="100%">
<p>The fragment if found or null otherwise.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="findFragmentByTag-java.lang.String-"></a>
<h3 class="api-name" id="findFragmentByTag(java.lang.String)">findFragmentByTag</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#findFragmentByTag(java.lang.String)">findFragmentByTag</a>(tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>?):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</pre>
<p>Finds a fragment that was identified by the given tag either when inflated from XML or as supplied when added in a transaction. This first searches through fragments that are currently added to the manager's activity; if no such fragment is found, then all fragments currently on the back stack are searched. </p>
<p>If provided a <code>{@code null}</code> tag, this method returns null.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</code></td>
<td width="100%">
<p>The fragment if found or null otherwise.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>?</code></td>
<td width="100%">
<p>the tag used to search for the fragment</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getBackStackEntryAt-int-"></a>
<h3 class="api-name" id="getBackStackEntryAt(int)">getBackStackEntryAt</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getBackStackEntryAt(int)">getBackStackEntryAt</a>(index:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.BackStackEntry.html">FragmentManager.BackStackEntry</a></pre>
<p>Return the BackStackEntry at index index in the back stack; entries start index 0 being the bottom of the stack.</p>
</div>
<div><a name="getBackStackEntryCount--"></a>
<h3 class="api-name" id="getBackStackEntryCount()">getBackStackEntryCount</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getBackStackEntryCount()">getBackStackEntryCount</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Return the number of entries currently in the back stack.</p>
</div>
<div><a name="getFragment(android.os.Bundle, java.lang.String)"></a><a name="getFragment-android.os.Bundle-java.lang.String-"></a>
<h3 class="api-name" id="getFragment(android.os.Bundle,java.lang.String)">getFragment</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getFragment(android.os.Bundle,java.lang.String)">getFragment</a>(bundle:&nbsp;Bundle,&nbsp;key:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</pre>
<p>Retrieve the current Fragment instance for a reference previously placed with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#putFragment(android.os.Bundle,java.lang.String,androidx.fragment.app.Fragment)">putFragment</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</code></td>
<td width="100%">
<p>Returns the current Fragment instance that is associated with the given reference.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>bundle:&nbsp;Bundle</code></td>
<td width="100%">
<p>The bundle from which to retrieve the fragment reference.</p>
</td>
</tr>
<tr>
<td><code>key:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>The name of the entry in the bundle.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getFragmentFactory--"></a>
<h3 class="api-name" id="getFragmentFactory()">getFragmentFactory</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getFragmentFactory()">getFragmentFactory</a>():&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a></pre>
<p>Gets the current <code><a href="/reference/kotlin/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a></code> used to instantiate new Fragment instances. </p>
<p>If no factory has been explicitly set on this FragmentManager via <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#setFragmentFactory(androidx.fragment.app.FragmentFactory)">setFragmentFactory</a></code>, the FragmentFactory of the <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html#getParentFragmentManager()">parent FragmentManager</a></code> will be returned.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a></code></td>
<td width="100%">
<p>the current FragmentFactory</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getFragments--"></a>
<h3 class="api-name" id="getFragments()">getFragments</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getFragments()">getFragments</a>():&nbsp;<a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;</pre>
<p>Get a list of all fragments that are currently added to the FragmentManager. This may include those that are hidden as well as those that are shown. This will not include any fragments only in the back stack, or fragments that are detached or removed. </p>
<p>The order of the fragments in the list is the order in which they were added or attached.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;</code></td>
<td width="100%">
<p>A list of all fragments that are added to the FragmentManager.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getPrimaryNavigationFragment--"></a>
<h3 class="api-name" id="getPrimaryNavigationFragment()">getPrimaryNavigationFragment</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getPrimaryNavigationFragment()">getPrimaryNavigationFragment</a>():&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</pre>
<p>Return the currently active primary navigation fragment for this FragmentManager. The primary navigation fragment is set by fragment transactions using <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setPrimaryNavigationFragment(androidx.fragment.app.Fragment)">FragmentTransaction#setPrimaryNavigationFragment(Fragment)</a></code>. </p>
<p>The primary navigation fragment's <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html#getChildFragmentManager()">child FragmentManager</a></code> will be called first to process delegated navigation actions such as <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack()">popBackStack</a></code> if no ID or transaction name is provided to pop to.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>?</code></td>
<td width="100%">
<p>the fragment designated as the primary navigation fragment</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="isDestroyed--"></a>
<h3 class="api-name" id="isDestroyed()">isDestroyed</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#isDestroyed()">isDestroyed</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Returns true if the final Activity.onDestroy() call has been made on the FragmentManager's Activity, so this instance is now dead.</p>
</div>
<div><a name="isStateSaved--"></a>
<h3 class="api-name" id="isStateSaved()">isStateSaved</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#isStateSaved()">isStateSaved</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Returns <code>{@code true}</code> if the FragmentManager's state has already been saved by its host. Any operations that would change saved state should not be performed if this method returns true. For example, any popBackStack() method, such as <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStackImmediate()">popBackStackImmediate</a></code> or any FragmentTransaction using <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commit()">FragmentTransaction#commit()</a></code> instead of <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commitAllowingStateLoss()">FragmentTransaction#commitAllowingStateLoss()</a></code> will change the state and will result in an error.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<p>true if this FragmentManager's state has already been saved by its host</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="popBackStack--"></a>
<h3 class="api-name" id="popBackStack()">popBackStack</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack()">popBackStack</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Pop the top state off the back stack. This function is asynchronous -- it enqueues the request to pop, but the action will not be performed until the application returns to its event loop.</p>
</div>
<div><a name="popBackStack(java.lang.String, int)"></a><a name="popBackStack-java.lang.String-int-"></a>
<h3 class="api-name" id="popBackStack(java.lang.String,int)">popBackStack</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(java.lang.String,int)">popBackStack</a>(name:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>?,&nbsp;flags:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Pop the last fragment transition from the manager's fragment back stack. This function is asynchronous -- it enqueues the request to pop, but the action will not be performed until the application returns to its event loop.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>name:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>?</code></td>
<td width="100%">
<p>If non-null, this is the name of a previous back state to look for; if found, all states up to that state will be popped. The <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#POP_BACK_STACK_INCLUSIVE()">POP_BACK_STACK_INCLUSIVE</a></code> flag can be used to control whether the named state itself is popped. If null, only the top state is popped.</p>
</td>
</tr>
<tr>
<td><code>flags:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>Either 0 or <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#POP_BACK_STACK_INCLUSIVE()">POP_BACK_STACK_INCLUSIVE</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="popBackStack(int, int)"></a><a name="popBackStack-int-int-"></a>
<h3 class="api-name" id="popBackStack(int,int)">popBackStack</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(int,int)">popBackStack</a>(id:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;flags:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Pop all back stack states up to the one with the given identifier. This function is asynchronous -- it enqueues the request to pop, but the action will not be performed until the application returns to its event loop.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>id:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>Identifier of the stated to be popped. If no identifier exists, false is returned. The identifier is the number returned by <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commit()">FragmentTransaction.commit()</a></code>. The <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#POP_BACK_STACK_INCLUSIVE()">POP_BACK_STACK_INCLUSIVE</a></code> flag can be used to control whether the named state itself is popped.</p>
</td>
</tr>
<tr>
<td><code>flags:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>Either 0 or <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#POP_BACK_STACK_INCLUSIVE()">POP_BACK_STACK_INCLUSIVE</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="popBackStackImmediate--"></a>
<h3 class="api-name" id="popBackStackImmediate()">popBackStackImmediate</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStackImmediate()">popBackStackImmediate</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack()">popBackStack</a></code>, but performs the operation immediately inside of the call. This is like calling <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#executePendingTransactions()">executePendingTransactions</a></code> afterwards without forcing the start of postponed Transactions.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<p>Returns true if there was something popped, else false.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="popBackStackImmediate(java.lang.String, int)"></a><a name="popBackStackImmediate-java.lang.String-int-"></a>
<h3 class="api-name" id="popBackStackImmediate(java.lang.String,int)">popBackStackImmediate</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStackImmediate(java.lang.String,int)">popBackStackImmediate</a>(name:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>?,&nbsp;flags:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(java.lang.String,int)">popBackStack</a></code>, but performs the operation immediately inside of the call. This is like calling <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#executePendingTransactions()">executePendingTransactions</a></code> afterwards without forcing the start of postponed Transactions.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<p>Returns true if there was something popped, else false.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="popBackStackImmediate(int, int)"></a><a name="popBackStackImmediate-int-int-"></a>
<h3 class="api-name" id="popBackStackImmediate(int,int)">popBackStackImmediate</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStackImmediate(int,int)">popBackStackImmediate</a>(id:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;flags:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack(int,int)">popBackStack</a></code>, but performs the operation immediately inside of the call. This is like calling <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#executePendingTransactions()">executePendingTransactions</a></code> afterwards without forcing the start of postponed Transactions.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<p>Returns true if there was something popped, else false.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="putFragment(android.os.Bundle, java.lang.String, androidx.fragment.app.Fragment)"></a><a name="putFragment-android.os.Bundle-java.lang.String-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="putFragment(android.os.Bundle,java.lang.String,androidx.fragment.app.Fragment)">putFragment</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#putFragment(android.os.Bundle,java.lang.String,androidx.fragment.app.Fragment)">putFragment</a>(bundle:&nbsp;Bundle,&nbsp;key:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>,&nbsp;fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Put a reference to a fragment in a Bundle. This Bundle can be persisted as saved state, and when later restoring <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getFragment(android.os.Bundle,java.lang.String)">getFragment</a></code> will return the current instance of the same fragment.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>bundle:&nbsp;Bundle</code></td>
<td width="100%">
<p>The bundle in which to put the fragment reference.</p>
</td>
</tr>
<tr>
<td><code>key:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>The name of the entry in the bundle.</p>
</td>
</tr>
<tr>
<td><code>fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td width="100%">
<p>The Fragment whose reference is to be stored.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="registerFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks, boolean)"></a><a name="registerFragmentLifecycleCallbacks-androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks-boolean-"></a>
<h3 class="api-name" id="registerFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks,boolean)">registerFragmentLifecycleCallbacks</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#registerFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks,boolean)">registerFragmentLifecycleCallbacks</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;cb:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html">FragmentManager.FragmentLifecycleCallbacks</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;recursive:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a><br>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Registers a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html">FragmentLifecycleCallbacks</a></code> to listen to fragment lifecycle events happening in this FragmentManager. All registered callbacks will be automatically unregistered when this FragmentManager is destroyed.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>cb:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html">FragmentManager.FragmentLifecycleCallbacks</a></code></td>
<td width="100%">
<p>Callbacks to register</p>
</td>
</tr>
<tr>
<td><code>recursive:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<p>true to automatically register this callback for all child FragmentManagers</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="removeFragmentOnAttachListener-androidx.fragment.app.FragmentOnAttachListener-"></a>
<h3 class="api-name" id="removeFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener)">removeFragmentOnAttachListener</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#removeFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener)">removeFragmentOnAttachListener</a>(listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html">FragmentOnAttachListener</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Remove a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html">FragmentOnAttachListener</a></code> that was previously added via <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#addFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener)">addFragmentOnAttachListener</a></code>. It will no longer get called when a new Fragment is attached.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentOnAttachListener.html">FragmentOnAttachListener</a></code></td>
<td width="100%">
<p>Listener to remove</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="removeOnBackStackChangedListener-androidx.fragment.app.FragmentManager.OnBackStackChangedListener-"></a>
<h3 class="api-name" id="removeOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener)">removeOnBackStackChangedListener</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#removeOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener)">removeOnBackStackChangedListener</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.OnBackStackChangedListener.html">FragmentManager.OnBackStackChangedListener</a><br>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Remove a listener that was previously added with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#addOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener)">addOnBackStackChangedListener</a></code>.</p>
</div>
<div><a name="saveFragmentInstanceState-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="saveFragmentInstanceState(androidx.fragment.app.Fragment)">saveFragmentInstanceState</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#saveFragmentInstanceState(androidx.fragment.app.Fragment)">saveFragmentInstanceState</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.SavedState.html">Fragment.SavedState</a>?</pre>
<p>Save the current instance state of the given Fragment. This can be used later when creating a new instance of the Fragment and adding it to the fragment manager, to have it create itself to match the current state returned here. Note that there are limits on how this can be used: </p>
<ul>
<li>The Fragment must currently be attached to the FragmentManager. </li>
<li>A new Fragment created using this saved state must be the same class type as the Fragment it was created from. </li>
<li>The saved state can not contain dependencies on other fragments -- that is it can't use <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#putFragment(android.os.Bundle,java.lang.String,androidx.fragment.app.Fragment)">putFragment</a></code> to store a fragment reference because that reference may not be valid when this saved state is later used. Likewise the Fragment's target and result code are not included in this state. </li>
</ul>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.SavedState.html">Fragment.SavedState</a>?</code></td>
<td width="100%">
<p>The generated state. This will be null if there was no interesting state created by the fragment.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td width="100%">
<p>The Fragment whose state is to be saved.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setFragmentFactory-androidx.fragment.app.FragmentFactory-"></a>
<h3 class="api-name" id="setFragmentFactory(androidx.fragment.app.FragmentFactory)">setFragmentFactory</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#setFragmentFactory(androidx.fragment.app.FragmentFactory)">setFragmentFactory</a>(fragmentFactory:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Set a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a></code> for this FragmentManager that will be used to create new Fragment instances from this point onward. </p>
<p>The <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html#getChildFragmentManager()">child FragmentManager</a></code> of all Fragments in this FragmentManager will also use this factory if one is not explicitly set.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>fragmentFactory:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a></code></td>
<td width="100%">
<p>the factory to use to create new Fragment instances</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">See also</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getFragmentFactory()">getFragmentFactory</a></code></td>
<td width="100%">
<p>#getFragmentFactory()</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setFragmentResult(java.lang.String, android.os.Bundle)"></a><a name="setFragmentResult-java.lang.String-android.os.Bundle-"></a>
<h3 class="api-name" id="setFragmentResult(java.lang.String,android.os.Bundle)">setFragmentResult</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#setFragmentResult(java.lang.String,android.os.Bundle)">setFragmentResult</a>(requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>,&nbsp;result:&nbsp;Bundle):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Sets the given result for the requestKey. This result will be delivered to a <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code> that is called given to <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultOwner.html#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)">setFragmentResultListener</a></code> with the same requestKey. If no <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code> with the same key is set or the Lifecycle associated with the listener is not at least STARTED, the result is stored until one becomes available, or <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultOwner.html#clearFragmentResult(java.lang.String)">clearFragmentResult</a></code> is called with the same requestKey.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>key used to identify the result</p>
</td>
</tr>
<tr>
<td><code>result:&nbsp;Bundle</code></td>
<td width="100%">
<p>the result to be passed to another fragment</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setFragmentResultListener(java.lang.String, androidx.lifecycle.LifecycleOwner, androidx.fragment.app.FragmentResultListener)"></a><a name="setFragmentResultListener-java.lang.String-androidx.lifecycle.LifecycleOwner-androidx.fragment.app.FragmentResultListener-"></a>
<h3 class="api-name" id="setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)">setFragmentResultListener</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)">setFragmentResultListener</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;lifecycleOwner:&nbsp;LifecycleOwner,<br>&nbsp;&nbsp;&nbsp;&nbsp;listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a><br>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Sets the <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code> for a given requestKey. Once the given LifecycleOwner is at least in the STARTED state, any results set by <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultOwner.html#setFragmentResult(java.lang.String,android.os.Bundle)">setFragmentResult</a></code> using the same requestKey will be delivered to the <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html#onFragmentResult(java.lang.String,android.os.Bundle)">callback</a></code>. The callback will remain active until the LifecycleOwner reaches the DESTROYED state or <code><a href="/reference/kotlin/androidx/fragment/app/FragmentResultOwner.html#clearFragmentResultListener(java.lang.String)">clearFragmentResultListener</a></code> is called with the same requestKey.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>requestKey:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>requestKey used to identify the result</p>
</td>
</tr>
<tr>
<td><code>lifecycleOwner:&nbsp;LifecycleOwner</code></td>
<td width="100%">
<p>lifecycleOwner for handling the result</p>
</td>
</tr>
<tr>
<td><code>listener:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code></td>
<td width="100%">
<p>listener for result changes</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="toString--"></a>
<h3 class="api-name" id="toString()">toString</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#toString()">toString</a>():&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></pre>
</div>
<div><a name="unregisterFragmentLifecycleCallbacks-androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks-"></a>
<h3 class="api-name" id="unregisterFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks)">unregisterFragmentLifecycleCallbacks</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#unregisterFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks)">unregisterFragmentLifecycleCallbacks</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;cb:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html">FragmentManager.FragmentLifecycleCallbacks</a><br>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Unregisters a previously registered <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html">FragmentLifecycleCallbacks</a></code>. If the callback was not previously registered this call has no effect. All registered callbacks will be automatically unregistered when this FragmentManager is destroyed.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>cb:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html">FragmentManager.FragmentLifecycleCallbacks</a></code></td>
<td width="100%">
<p>Callbacks to unregister</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>