blob: 144b4ece822180c814e681bd7cf2050b66863f8a [file] [log] [blame]
<html devsite="true">
<head>
<title>FragmentTransaction</title>
{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>FragmentTransaction</h1>
{% setvar page_path %}androidx/fragment/app/FragmentTransaction.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_kotlin_switcher2.md" %}
<p>
<pre>abstract class FragmentTransaction</pre>
</p>
<hr>
<p>Static library support version of the framework's android.app.FragmentTransaction. 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 SDK documentation for a class overview.</p>
<h2>Summary</h2>
<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/FragmentTransaction.html#TRANSIT_ENTER_MASK()">TRANSIT_ENTER_MASK</a></code></div>
<p>Bit mask that is set for all enter transitions.</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/FragmentTransaction.html#TRANSIT_EXIT_MASK()">TRANSIT_EXIT_MASK</a></code></div>
<p>Bit mask that is set for all exit transitions.</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/FragmentTransaction.html#TRANSIT_FRAGMENT_CLOSE()">TRANSIT_FRAGMENT_CLOSE</a></code></div>
<p>Fragment is being removed from 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/FragmentTransaction.html#TRANSIT_FRAGMENT_FADE()">TRANSIT_FRAGMENT_FADE</a></code></div>
<p>Fragment should simply fade in or out; that is, no strong navigation associated with it except that it is appearing or disappearing for some reason.</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/FragmentTransaction.html#TRANSIT_FRAGMENT_OPEN()">TRANSIT_FRAGMENT_OPEN</a></code></div>
<p>Fragment is being added onto 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/FragmentTransaction.html#TRANSIT_NONE()">TRANSIT_NONE</a></code></div>
<p>No animation for transition.</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/FragmentTransaction.html#TRANSIT_UNSET()">TRANSIT_UNSET</a></code></div>
<p>Not set up for a transition.</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><span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#FragmentTransaction()">FragmentTransaction</a></del></span>()</code></div>
<p><strong>This function is deprecated.</strong>
<p>You should not instantiate a FragmentTransaction except via <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#beginTransaction()">FragmentManager#beginTransaction()</a></code>.</p>
</p>
</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="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">add</a>(fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;,&nbsp;args:&nbsp;Bundle,&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>)</code></div>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">add</a></code> with a 0 containerViewId.</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/FragmentTransaction.html#add(androidx.fragment.app.Fragment,java.lang.String)">add</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>,&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>)</code></div>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,androidx.fragment.app.Fragment,java.lang.String)">add</a></code> with a 0 containerViewId.</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/FragmentTransaction.html#add(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle)">add</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;,&nbsp;args:&nbsp;Bundle)</code></div>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">add</a></code> with a null tag.</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/FragmentTransaction.html#add(int,androidx.fragment.app.Fragment)">add</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>)</code></div>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,androidx.fragment.app.Fragment,java.lang.String)">add</a></code> with a null tag.</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/FragmentTransaction.html#add(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">add</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;args:&nbsp;Bundle,<br>&nbsp;&nbsp;&nbsp;&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a><br>)</code></div>
<p>Add a fragment to the activity state.</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/FragmentTransaction.html#add(int,androidx.fragment.app.Fragment,java.lang.String)">add</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>,&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>)</code></div>
<p>Add a fragment to the activity state.</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/FragmentTransaction.html#addSharedElement(android.view.View,java.lang.String)">addSharedElement</a>(sharedElement:&nbsp;View,&nbsp;name:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>)</code></div>
<p>Used with custom Transitions to map a View from a removed or hidden Fragment to a View from a shown or added Fragment.</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/FragmentTransaction.html#addToBackStack(java.lang.String)">addToBackStack</a>(name:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>)</code></div>
<p>Add this transaction to the 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/FragmentTransaction.html#attach(androidx.fragment.app.Fragment)">attach</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>)</code></div>
<p>Re-attach a fragment after it had previously been detached from the UI with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#detach(androidx.fragment.app.Fragment)">detach</a></code>.</p>
</td>
</tr>
<tr>
<td><code>abstract <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/FragmentTransaction.html#commit()">commit</a>()</code></div>
<p>Schedules a commit of this transaction.</p>
</td>
</tr>
<tr>
<td><code>abstract <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/FragmentTransaction.html#commitAllowingStateLoss()">commitAllowingStateLoss</a>()</code></div>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commit()">commit</a></code> but allows the commit to be executed after an activity's state is saved.</p>
</td>
</tr>
<tr>
<td><code>abstract <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/FragmentTransaction.html#commitNow()">commitNow</a>()</code></div>
<p>Commits this transaction synchronously.</p>
</td>
</tr>
<tr>
<td><code>abstract <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/FragmentTransaction.html#commitNowAllowingStateLoss()">commitNowAllowingStateLoss</a>()</code></div>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commitNow()">commitNow</a></code> but allows the commit to be executed after an activity's state is saved.</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/FragmentTransaction.html#detach(androidx.fragment.app.Fragment)">detach</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>)</code></div>
<p>Detach the given fragment from the UI.</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/FragmentTransaction.html#disallowAddToBackStack()">disallowAddToBackStack</a>()</code></div>
<p>Disallow calls to <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addToBackStack(java.lang.String)">addToBackStack</a></code>.</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/FragmentTransaction.html#hide(androidx.fragment.app.Fragment)">hide</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>)</code></div>
<p>Hides an existing fragment.</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/FragmentTransaction.html#isAddToBackStackAllowed()">isAddToBackStackAllowed</a>()</code></div>
<p>Returns true if this FragmentTransaction is allowed to be added to the back stack.</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/FragmentTransaction.html#isEmpty()">isEmpty</a>()</code></div>
</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/FragmentTransaction.html#remove(androidx.fragment.app.Fragment)">remove</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>)</code></div>
<p>Remove an existing fragment.</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/FragmentTransaction.html#replace(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle)">replace</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;,&nbsp;args:&nbsp;Bundle)</code></div>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#replace(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">replace</a></code> with a null tag.</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/FragmentTransaction.html#replace(int,androidx.fragment.app.Fragment)">replace</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>)</code></div>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#replace(int,androidx.fragment.app.Fragment,java.lang.String)">replace</a></code> with a null tag.</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/FragmentTransaction.html#replace(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">replace</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;args:&nbsp;Bundle,<br>&nbsp;&nbsp;&nbsp;&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a><br>)</code></div>
<p>Replace an existing fragment that was added to a container.</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/FragmentTransaction.html#replace(int,androidx.fragment.app.Fragment,java.lang.String)">replace</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>,&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>)</code></div>
<p>Replace an existing fragment that was added to a container.</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/FragmentTransaction.html#runOnCommit(java.lang.Runnable)">runOnCommit</a>(runnable:&nbsp;<a href="https://developer.android.com/reference/java/lang/Runnable.html">Runnable</a>)</code></div>
<p>Add a Runnable to this transaction that will be run after this transaction has been committed.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setAllowOptimization(boolean)">setAllowOptimization</a></del></span>(allowOptimization:&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>This has been renamed <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setReorderingAllowed(boolean)">setReorderingAllowed</a></code>.</p>
</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setBreadCrumbShortTitle(int)">setBreadCrumbShortTitle</a></del></span>(res:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p><strong>This function is deprecated.</strong>
<p>Store breadcrumb short titles separately from fragment transactions.</p>
</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setBreadCrumbShortTitle(java.lang.CharSequence)">setBreadCrumbShortTitle</a></del></span>(text:&nbsp;<a href="https://developer.android.com/reference/java/lang/CharSequence.html">CharSequence</a>)</code></div>
<p><strong>This function is deprecated.</strong>
<p>Store breadcrumb short titles separately from fragment transactions.</p>
</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setBreadCrumbTitle(int)">setBreadCrumbTitle</a></del></span>(res:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p><strong>This function is deprecated.</strong>
<p>Store breadcrumb titles separately from fragment transactions.</p>
</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setBreadCrumbTitle(java.lang.CharSequence)">setBreadCrumbTitle</a></del></span>(text:&nbsp;<a href="https://developer.android.com/reference/java/lang/CharSequence.html">CharSequence</a>)</code></div>
<p><strong>This function is deprecated.</strong>
<p>Store breadcrumb titles separately from fragment transactions.</p>
</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/FragmentTransaction.html#setCustomAnimations(int,int)">setCustomAnimations</a>(enter:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;exit:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Set specific animation resources to run for the fragments that are entering and exiting in this transaction.</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/FragmentTransaction.html#setCustomAnimations(int,int,int,int)">setCustomAnimations</a>(enter:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;exit:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;popEnter:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;popExit:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Set specific animation resources to run for the fragments that are entering and exiting in this transaction.</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/FragmentTransaction.html#setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)">setMaxLifecycle</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>,&nbsp;state:&nbsp;State)</code></div>
<p>Set a ceiling for the state of an active fragment in this FragmentManager.</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/FragmentTransaction.html#setPrimaryNavigationFragment(androidx.fragment.app.Fragment)">setPrimaryNavigationFragment</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>)</code></div>
<p>Set a currently active fragment in this FragmentManager as the primary navigation fragment.</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/FragmentTransaction.html#setReorderingAllowed(boolean)">setReorderingAllowed</a>(reorderingAllowed:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a>)</code></div>
<p>Sets whether or not to allow optimizing operations within and across transactions.</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/FragmentTransaction.html#setTransition(int)">setTransition</a>(transition:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Select a standard transition animation for this transaction.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setTransitionStyle(int)">setTransitionStyle</a></del></span>(styleRes:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p><strong>This function is deprecated.</strong>
<p>The desired functionality never worked correctly.</p>
</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/FragmentTransaction.html#show(androidx.fragment.app.Fragment)">show</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>)</code></div>
<p>Shows a previously hidden fragment.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Constants</h2>
<div><a name="getTRANSIT_ENTER_MASK()"></a><a name="setTRANSIT_ENTER_MASK()"></a><a name="getTRANSIT_ENTER_MASK--"></a><a name="setTRANSIT_ENTER_MASK--"></a>
<h3 class="api-name" id="TRANSIT_ENTER_MASK()">TRANSIT_ENTER_MASK</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_ENTER_MASK()">TRANSIT_ENTER_MASK</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Bit mask that is set for all enter transitions.</p>
</div>
<div><a name="getTRANSIT_EXIT_MASK()"></a><a name="setTRANSIT_EXIT_MASK()"></a><a name="getTRANSIT_EXIT_MASK--"></a><a name="setTRANSIT_EXIT_MASK--"></a>
<h3 class="api-name" id="TRANSIT_EXIT_MASK()">TRANSIT_EXIT_MASK</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_EXIT_MASK()">TRANSIT_EXIT_MASK</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Bit mask that is set for all exit transitions.</p>
</div>
<div><a name="getTRANSIT_FRAGMENT_CLOSE()"></a><a name="setTRANSIT_FRAGMENT_CLOSE()"></a><a name="getTRANSIT_FRAGMENT_CLOSE--"></a><a name="setTRANSIT_FRAGMENT_CLOSE--"></a>
<h3 class="api-name" id="TRANSIT_FRAGMENT_CLOSE()">TRANSIT_FRAGMENT_CLOSE</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_FRAGMENT_CLOSE()">TRANSIT_FRAGMENT_CLOSE</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Fragment is being removed from the stack</p>
</div>
<div><a name="getTRANSIT_FRAGMENT_FADE()"></a><a name="setTRANSIT_FRAGMENT_FADE()"></a><a name="getTRANSIT_FRAGMENT_FADE--"></a><a name="setTRANSIT_FRAGMENT_FADE--"></a>
<h3 class="api-name" id="TRANSIT_FRAGMENT_FADE()">TRANSIT_FRAGMENT_FADE</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_FRAGMENT_FADE()">TRANSIT_FRAGMENT_FADE</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Fragment should simply fade in or out; that is, no strong navigation associated with it except that it is appearing or disappearing for some reason.</p>
</div>
<div><a name="getTRANSIT_FRAGMENT_OPEN()"></a><a name="setTRANSIT_FRAGMENT_OPEN()"></a><a name="getTRANSIT_FRAGMENT_OPEN--"></a><a name="setTRANSIT_FRAGMENT_OPEN--"></a>
<h3 class="api-name" id="TRANSIT_FRAGMENT_OPEN()">TRANSIT_FRAGMENT_OPEN</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_FRAGMENT_OPEN()">TRANSIT_FRAGMENT_OPEN</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Fragment is being added onto the stack</p>
</div>
<div><a name="getTRANSIT_NONE()"></a><a name="setTRANSIT_NONE()"></a><a name="getTRANSIT_NONE--"></a><a name="setTRANSIT_NONE--"></a>
<h3 class="api-name" id="TRANSIT_NONE()">TRANSIT_NONE</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_NONE()">TRANSIT_NONE</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>No animation for transition.</p>
</div>
<div><a name="getTRANSIT_UNSET()"></a><a name="setTRANSIT_UNSET()"></a><a name="getTRANSIT_UNSET--"></a><a name="setTRANSIT_UNSET--"></a>
<h3 class="api-name" id="TRANSIT_UNSET()">TRANSIT_UNSET</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_UNSET()">TRANSIT_UNSET</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Not set up for a transition.</p>
</div>
<h2>Public constructors</h2>
<div><a name="FragmentTransaction--"></a>
<h3 class="api-name" id="FragmentTransaction()">FragmentTransaction</h3>
<pre class="api-signature no-pretty-print"><span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#FragmentTransaction()">FragmentTransaction</a></del></span>()</pre>
<aside class="caution"><strong>This function is deprecated.</strong><br>
<p>You should not instantiate a FragmentTransaction except via <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#beginTransaction()">FragmentManager#beginTransaction()</a></code>.</p>
</aside>
</div>
<h2>Public functions</h2>
<div><a name="add(java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;, android.os.Bundle, java.lang.String)"></a><a name="add-java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;-android.os.Bundle-java.lang.String-"></a>
<h3 class="api-name" id="add(java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">add</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">add</a>(fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;,&nbsp;args:&nbsp;Bundle,&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">add</a></code> with a 0 containerViewId.</p>
</div>
<div><a name="add(androidx.fragment.app.Fragment, java.lang.String)"></a><a name="add-androidx.fragment.app.Fragment-java.lang.String-"></a>
<h3 class="api-name" id="add(androidx.fragment.app.Fragment,java.lang.String)">add</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(androidx.fragment.app.Fragment,java.lang.String)">add</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>,&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,androidx.fragment.app.Fragment,java.lang.String)">add</a></code> with a 0 containerViewId.</p>
</div>
<div><a name="add(int, java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;, android.os.Bundle)"></a><a name="add-int-java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;-android.os.Bundle-"></a>
<h3 class="api-name" id="add(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle)">add</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle)">add</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;,&nbsp;args:&nbsp;Bundle):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">add</a></code> with a null tag.</p>
</div>
<div><a name="add(int, androidx.fragment.app.Fragment)"></a><a name="add-int-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="add(int,androidx.fragment.app.Fragment)">add</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,androidx.fragment.app.Fragment)">add</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,androidx.fragment.app.Fragment,java.lang.String)">add</a></code> with a null tag.</p>
</div>
<div><a name="add(int, java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;, android.os.Bundle, java.lang.String)"></a><a name="add-int-java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;-android.os.Bundle-java.lang.String-"></a>
<h3 class="api-name" id="add(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">add</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">add</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;args:&nbsp;Bundle,<br>&nbsp;&nbsp;&nbsp;&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a><br>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Add a fragment to the activity state. This fragment may optionally also have its view (if <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">Fragment.onCreateView</a></code> returns non-null) into a container view of the activity.</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>Returns the same FragmentTransaction instance.</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>containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>Optional identifier of the container this fragment is to be placed in. If 0, it will not be placed in a container.</p>
</td>
</tr>
<tr>
<td><code>fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;</code></td>
<td width="100%">
<p>The fragment to be added, created via the <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getFragmentFactory()">FragmentManager's FragmentFactory</a></code>.</p>
</td>
</tr>
<tr>
<td><code>args:&nbsp;Bundle</code></td>
<td width="100%">
<p>Optional arguments to be set on the fragment.</p>
</td>
</tr>
<tr>
<td><code>tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>Optional tag name for the fragment, to later retrieve the fragment with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#findFragmentByTag(java.lang.String)">FragmentManager.findFragmentByTag(String)</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="add(int, androidx.fragment.app.Fragment, java.lang.String)"></a><a name="add-int-androidx.fragment.app.Fragment-java.lang.String-"></a>
<h3 class="api-name" id="add(int,androidx.fragment.app.Fragment,java.lang.String)">add</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,androidx.fragment.app.Fragment,java.lang.String)">add</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>,&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Add a fragment to the activity state. This fragment may optionally also have its view (if <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">Fragment.onCreateView</a></code> returns non-null) into a container view of the activity.</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>Returns the same FragmentTransaction instance.</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>containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>Optional identifier of the container this fragment is to be placed in. If 0, it will not be placed in a container.</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 to be added. This fragment must not already be added to the activity.</p>
</td>
</tr>
<tr>
<td><code>tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>Optional tag name for the fragment, to later retrieve the fragment with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#findFragmentByTag(java.lang.String)">FragmentManager.findFragmentByTag(String)</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="addSharedElement(android.view.View, java.lang.String)"></a><a name="addSharedElement-android.view.View-java.lang.String-"></a>
<h3 class="api-name" id="addSharedElement(android.view.View,java.lang.String)">addSharedElement</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addSharedElement(android.view.View,java.lang.String)">addSharedElement</a>(sharedElement:&nbsp;View,&nbsp;name:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Used with custom Transitions to map a View from a removed or hidden Fragment to a View from a shown or added Fragment. sharedElement must have a unique transitionName in the View hierarchy.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>sharedElement:&nbsp;View</code></td>
<td width="100%">
<p>A View in a disappearing Fragment to match with a View in an appearing Fragment.</p>
</td>
</tr>
<tr>
<td><code>name:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>The transitionName for a View in an appearing Fragment to match to the shared element.</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/Fragment.html#setSharedElementReturnTransition(java.lang.Object)">setSharedElementReturnTransition</a></code></td>
<td width="100%">
<p>androidx.fragment.app.Fragment#setSharedElementReturnTransition(Object)</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html#setSharedElementEnterTransition(java.lang.Object)">setSharedElementEnterTransition</a></code></td>
<td width="100%">
<p>androidx.fragment.app.Fragment#setSharedElementEnterTransition(Object)</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="addToBackStack-java.lang.String-"></a>
<h3 class="api-name" id="addToBackStack(java.lang.String)">addToBackStack</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addToBackStack(java.lang.String)">addToBackStack</a>(name:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Add this transaction to the back stack. This means that the transaction will be remembered after it is committed, and will reverse its operation when later popped off the stack. </p>
<p><code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setReorderingAllowed(boolean)">setReorderingAllowed</a></code> must be set to <code>true</code>in the same transaction as addToBackStack() to allow the pop of that transaction to be reordered.</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>An optional name for this back stack state, or null.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="attach-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="attach(androidx.fragment.app.Fragment)">attach</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#attach(androidx.fragment.app.Fragment)">attach</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Re-attach a fragment after it had previously been detached from the UI with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#detach(androidx.fragment.app.Fragment)">detach</a></code>. This causes its view hierarchy to be re-created, attached to the UI, and displayed.</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>Returns the same FragmentTransaction instance.</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 to be attached.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="commit--"></a>
<h3 class="api-name" id="commit()">commit</h3>
<pre class="api-signature no-pretty-print">abstract&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commit()">commit</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Schedules a commit of this transaction. The commit does not happen immediately; it will be scheduled as work on the main thread to be done the next time that thread is ready. </p>
<p>A transaction can only be committed with this method prior to its containing activity saving its state. If the commit is attempted after that point, an exception will be thrown. This is because the state after the commit can be lost if the activity needs to be restored from its state. See <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commitAllowingStateLoss()">commitAllowingStateLoss</a></code> for situations where it may be okay to lose the commit.</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/-int/index.html">Int</a></code></td>
<td width="100%">
<p>Returns the identifier of this transaction's back stack entry, if <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addToBackStack(java.lang.String)">addToBackStack</a></code> had been called. Otherwise, returns a negative number.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="commitAllowingStateLoss--"></a>
<h3 class="api-name" id="commitAllowingStateLoss()">commitAllowingStateLoss</h3>
<pre class="api-signature no-pretty-print">abstract&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commitAllowingStateLoss()">commitAllowingStateLoss</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commit()">commit</a></code> but allows the commit to be executed after an activity's state is saved. This is dangerous because the commit can be lost if the activity needs to later be restored from its state, so this should only be used for cases where it is okay for the UI state to change unexpectedly on the user.</p>
</div>
<div><a name="commitNow--"></a>
<h3 class="api-name" id="commitNow()">commitNow</h3>
<pre class="api-signature no-pretty-print">abstract&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commitNow()">commitNow</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Commits this transaction synchronously. Any added fragments will be initialized and brought completely to the lifecycle state of their host and any removed fragments will be torn down accordingly before this call returns. Committing a transaction in this way allows fragments to be added as dedicated, encapsulated components that monitor the lifecycle state of their host while providing firmer ordering guarantees around when those fragments are fully initialized and ready. Fragments that manage views will have those views created and attached. </p>
<p>Calling <code>commitNow</code> is preferable to calling <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commit()">commit</a></code> followed by <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#executePendingTransactions()">FragmentManager#executePendingTransactions()</a></code> as the latter will have the side effect of attempting to commit <em>all</em>currently pending transactions whether that is the desired behavior or not.</p>
<p>Transactions committed in this way may not be added to the FragmentManager's back stack, as doing so would break other expected ordering guarantees for other asynchronously committed transactions. This method will throw <code><a href="https://developer.android.com/reference/java/lang/IllegalStateException.html">IllegalStateException</a></code> if the transaction previously requested to be added to the back stack with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addToBackStack(java.lang.String)">addToBackStack</a></code>.</p>
<p>A transaction can only be committed with this method prior to its containing activity saving its state. If the commit is attempted after that point, an exception will be thrown. This is because the state after the commit can be lost if the activity needs to be restored from its state. See <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commitAllowingStateLoss()">commitAllowingStateLoss</a></code> for situations where it may be okay to lose the commit.</p>
</div>
<div><a name="commitNowAllowingStateLoss--"></a>
<h3 class="api-name" id="commitNowAllowingStateLoss()">commitNowAllowingStateLoss</h3>
<pre class="api-signature no-pretty-print">abstract&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commitNowAllowingStateLoss()">commitNowAllowingStateLoss</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commitNow()">commitNow</a></code> but allows the commit to be executed after an activity's state is saved. This is dangerous because the commit can be lost if the activity needs to later be restored from its state, so this should only be used for cases where it is okay for the UI state to change unexpectedly on the user.</p>
</div>
<div><a name="detach-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="detach(androidx.fragment.app.Fragment)">detach</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#detach(androidx.fragment.app.Fragment)">detach</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Detach the given fragment from the UI. This is the same state as when it is put on the back stack: the fragment is removed from the UI, however its state is still being actively managed by the fragment manager. When going into this state its view hierarchy is destroyed.</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>Returns the same FragmentTransaction instance.</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 to be detached.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="disallowAddToBackStack--"></a>
<h3 class="api-name" id="disallowAddToBackStack()">disallowAddToBackStack</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#disallowAddToBackStack()">disallowAddToBackStack</a>():&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Disallow calls to <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addToBackStack(java.lang.String)">addToBackStack</a></code>. Any future calls to addToBackStack will throw <code><a href="https://developer.android.com/reference/java/lang/IllegalStateException.html">IllegalStateException</a></code>. If addToBackStack has already been called, this method will throw IllegalStateException.</p>
</div>
<div><a name="hide-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="hide(androidx.fragment.app.Fragment)">hide</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#hide(androidx.fragment.app.Fragment)">hide</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Hides an existing fragment. This is only relevant for fragments whose views have been added to a container, as this will cause the view to be hidden.</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>Returns the same FragmentTransaction instance.</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 to be hidden.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="isAddToBackStackAllowed--"></a>
<h3 class="api-name" id="isAddToBackStackAllowed()">isAddToBackStackAllowed</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#isAddToBackStackAllowed()">isAddToBackStackAllowed</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Returns true if this FragmentTransaction is allowed to be added to the back stack. If this method would return false, <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addToBackStack(java.lang.String)">addToBackStack</a></code> will throw <code><a href="https://developer.android.com/reference/java/lang/IllegalStateException.html">IllegalStateException</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="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<p>True if <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addToBackStack(java.lang.String)">addToBackStack</a></code> is permitted on this transaction.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="isEmpty--"></a>
<h3 class="api-name" id="isEmpty()">isEmpty</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#isEmpty()">isEmpty</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<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><code>true</code> if this transaction contains no operations, <code>false</code> otherwise.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="remove-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="remove(androidx.fragment.app.Fragment)">remove</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#remove(androidx.fragment.app.Fragment)">remove</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Remove an existing fragment. If it was added to a container, its view is also removed from that container.</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>Returns the same FragmentTransaction instance.</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 to be removed.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="replace(int, java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;, android.os.Bundle)"></a><a name="replace-int-java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;-android.os.Bundle-"></a>
<h3 class="api-name" id="replace(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle)">replace</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#replace(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle)">replace</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;,&nbsp;args:&nbsp;Bundle):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#replace(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">replace</a></code> with a null tag.</p>
</div>
<div><a name="replace(int, androidx.fragment.app.Fragment)"></a><a name="replace-int-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="replace(int,androidx.fragment.app.Fragment)">replace</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#replace(int,androidx.fragment.app.Fragment)">replace</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Calls <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#replace(int,androidx.fragment.app.Fragment,java.lang.String)">replace</a></code> with a null tag.</p>
</div>
<div><a name="replace(int, java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;, android.os.Bundle, java.lang.String)"></a><a name="replace-int-java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;-android.os.Bundle-java.lang.String-"></a>
<h3 class="api-name" id="replace(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">replace</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#replace(int,java.lang.Class&lt;? extends androidx.fragment.app.Fragment&gt;,android.os.Bundle,java.lang.String)">replace</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;args:&nbsp;Bundle,<br>&nbsp;&nbsp;&nbsp;&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a><br>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Replace an existing fragment that was added to a container. This is essentially the same as calling <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#remove(androidx.fragment.app.Fragment)">remove</a></code> for all currently added fragments that were added with the same containerViewId and then <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,androidx.fragment.app.Fragment,java.lang.String)">add</a></code> with the same arguments given here.</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>Returns the same FragmentTransaction instance.</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>containerViewId:&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 container whose fragment(s) are to be replaced.</p>
</td>
</tr>
<tr>
<td><code>fragmentClass:&nbsp;<a href="https://developer.android.com/reference/java/lang/Class.html">Class</a>&lt;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>&gt;</code></td>
<td width="100%">
<p>The new fragment to place in the container, created via the <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getFragmentFactory()">FragmentManager's FragmentFactory</a></code>.</p>
</td>
</tr>
<tr>
<td><code>args:&nbsp;Bundle</code></td>
<td width="100%">
<p>Optional arguments to be set on the fragment.</p>
</td>
</tr>
<tr>
<td><code>tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>Optional tag name for the fragment, to later retrieve the fragment with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#findFragmentByTag(java.lang.String)">FragmentManager.findFragmentByTag(String)</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="replace(int, androidx.fragment.app.Fragment, java.lang.String)"></a><a name="replace-int-androidx.fragment.app.Fragment-java.lang.String-"></a>
<h3 class="api-name" id="replace(int,androidx.fragment.app.Fragment,java.lang.String)">replace</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#replace(int,androidx.fragment.app.Fragment,java.lang.String)">replace</a>(containerViewId:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>,&nbsp;tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Replace an existing fragment that was added to a container. This is essentially the same as calling <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#remove(androidx.fragment.app.Fragment)">remove</a></code> for all currently added fragments that were added with the same containerViewId and then <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#add(int,androidx.fragment.app.Fragment,java.lang.String)">add</a></code> with the same arguments given here.</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>Returns the same FragmentTransaction instance.</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>containerViewId:&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 container whose fragment(s) are to be replaced.</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 new fragment to place in the container.</p>
</td>
</tr>
<tr>
<td><code>tag:&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<p>Optional tag name for the fragment, to later retrieve the fragment with <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#findFragmentByTag(java.lang.String)">FragmentManager.findFragmentByTag(String)</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="runOnCommit-java.lang.Runnable-"></a>
<h3 class="api-name" id="runOnCommit(java.lang.Runnable)">runOnCommit</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#runOnCommit(java.lang.Runnable)">runOnCommit</a>(runnable:&nbsp;<a href="https://developer.android.com/reference/java/lang/Runnable.html">Runnable</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Add a Runnable to this transaction that will be run after this transaction has been committed. If fragment transactions are <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setReorderingAllowed(boolean)">optimized</a></code> this may be after other subsequent fragment operations have also taken place, or operations in this transaction may have been optimized out due to the presence of a subsequent fragment transaction in the batch. </p>
<p>If a transaction is committed using <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#commitAllowingStateLoss()">commitAllowingStateLoss</a></code> this runnable may be executed when the FragmentManager is in a state where new transactions may not be committed without allowing state loss.</p>
<p><code>runOnCommit</code> may not be used with transactions <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addToBackStack(java.lang.String)">added to the back stack</a></code> as Runnables cannot be persisted with back stack state. <code><a href="https://developer.android.com/reference/java/lang/IllegalStateException.html">IllegalStateException</a></code> will be thrown if <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addToBackStack(java.lang.String)">addToBackStack</a></code> has been previously called for this transaction or if it is called after a call to <code>runOnCommit</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>this FragmentTransaction</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>runnable:&nbsp;<a href="https://developer.android.com/reference/java/lang/Runnable.html">Runnable</a></code></td>
<td width="100%">
<p>Runnable to add</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 <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#addToBackStack(java.lang.String)">addToBackStack</a></code> has been called</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setAllowOptimization-boolean-"></a>
<h3 class="api-name" id="setAllowOptimization(boolean)">setAllowOptimization</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setAllowOptimization(boolean)">setAllowOptimization</a></del></span>(allowOptimization:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<aside class="caution"><strong>This function is deprecated.</strong><br>
<p>This has been renamed <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setReorderingAllowed(boolean)">setReorderingAllowed</a></code>.</p>
</aside>
</div>
<div><a name="setBreadCrumbShortTitle-int-"></a>
<h3 class="api-name" id="setBreadCrumbShortTitle(int)">setBreadCrumbShortTitle</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setBreadCrumbShortTitle(int)">setBreadCrumbShortTitle</a></del></span>(res:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<aside class="caution"><strong>This function is deprecated.</strong><br>
<p>Store breadcrumb short titles separately from fragment transactions. For example, by using an <code>android:label</code> on a fragment in a navigation graph.</p>
</aside>
<p>Set the short title to show as a bread crumb when this transaction is on the back stack.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>res:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>A string resource containing the title.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setBreadCrumbShortTitle-java.lang.CharSequence-"></a>
<h3 class="api-name" id="setBreadCrumbShortTitle(java.lang.CharSequence)">setBreadCrumbShortTitle</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setBreadCrumbShortTitle(java.lang.CharSequence)">setBreadCrumbShortTitle</a></del></span>(text:&nbsp;<a href="https://developer.android.com/reference/java/lang/CharSequence.html">CharSequence</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<aside class="caution"><strong>This function is deprecated.</strong><br>
<p>Store breadcrumb short titles separately from fragment transactions. For example, by using an <code>android:label</code> on a fragment in a navigation graph.</p>
</aside>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setBreadCrumbShortTitle(int)">setBreadCrumbShortTitle</a></code> but taking a raw string; this method is <em>not</em> recommended, as the string can not be changed later if the locale changes.</p>
</div>
<div><a name="setBreadCrumbTitle-int-"></a>
<h3 class="api-name" id="setBreadCrumbTitle(int)">setBreadCrumbTitle</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setBreadCrumbTitle(int)">setBreadCrumbTitle</a></del></span>(res:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<aside class="caution"><strong>This function is deprecated.</strong><br>
<p>Store breadcrumb titles separately from fragment transactions. For example, by using an <code>android:label</code> on a fragment in a navigation graph.</p>
</aside>
<p>Set the full title to show as a bread crumb when this transaction is on the back stack.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>res:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>A string resource containing the title.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setBreadCrumbTitle-java.lang.CharSequence-"></a>
<h3 class="api-name" id="setBreadCrumbTitle(java.lang.CharSequence)">setBreadCrumbTitle</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setBreadCrumbTitle(java.lang.CharSequence)">setBreadCrumbTitle</a></del></span>(text:&nbsp;<a href="https://developer.android.com/reference/java/lang/CharSequence.html">CharSequence</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<aside class="caution"><strong>This function is deprecated.</strong><br>
<p>Store breadcrumb titles separately from fragment transactions. For example, by using an <code>android:label</code> on a fragment in a navigation graph.</p>
</aside>
<p>Like <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setBreadCrumbTitle(int)">setBreadCrumbTitle</a></code> but taking a raw string; this method is <em>not</em> recommended, as the string can not be changed later if the locale changes.</p>
</div>
<div><a name="setCustomAnimations(int, int)"></a><a name="setCustomAnimations-int-int-"></a>
<h3 class="api-name" id="setCustomAnimations(int,int)">setCustomAnimations</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setCustomAnimations(int,int)">setCustomAnimations</a>(enter:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;exit:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Set specific animation resources to run for the fragments that are entering and exiting in this transaction. These animations will not be played when popping the back stack. </p>
<p>This method applies the custom animations to all future fragment operations; previous operations are unaffected. Fragment operations in the same <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code> can set different animations by calling this method prior to each operation, e.g: </p>
<pre class="prettyprint"> fragmentManager.beingTransaction()
.setCustomAnimations(enter1, exit1)
.add(MyFragmentClass, args, tag1) // this fragment gets the first animations
.setCustomAnimations(enter2, exit2)
.add(MyFragmentClass, args, tag2) // this fragment gets the second animations
.commit()
</pre>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>enter:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>An animation or animator resource ID used for the enter animation on the view of the fragment being added or attached.</p>
</td>
</tr>
<tr>
<td><code>exit:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>An animation or animator resource ID used for the exit animation on the view of the fragment being removed or detached.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setCustomAnimations(int, int, int, int)"></a><a name="setCustomAnimations-int-int-int-int-"></a>
<h3 class="api-name" id="setCustomAnimations(int,int,int,int)">setCustomAnimations</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setCustomAnimations(int,int,int,int)">setCustomAnimations</a>(enter:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;exit:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;popEnter:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;popExit:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Set specific animation resources to run for the fragments that are entering and exiting in this transaction. The <code>popEnter</code>and <code>popExit</code> animations will be played for enter/exit operations specifically when popping the back stack. </p>
<p>This method applies the custom animations to all future fragment operations; previous operations are unaffected. Fragment operations in the same <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code> can set different animations by calling this method prior to each operation, e.g: </p>
<pre class="prettyprint"> fragmentManager.beingTransaction()
.setCustomAnimations(enter1, exit1, popEnter1, popExit1)
.add(MyFragmentClass, args, tag1) // this fragment gets the first animations
.setCustomAnimations(enter2, exit2, popEnter2, popExit2)
.add(MyFragmentClass, args, tag2) // this fragment gets the second animations
.commit()
</pre>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>enter:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>An animation or animator resource ID used for the enter animation on the view of the fragment being added or attached.</p>
</td>
</tr>
<tr>
<td><code>exit:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>An animation or animator resource ID used for the exit animation on the view of the fragment being removed or detached.</p>
</td>
</tr>
<tr>
<td><code>popEnter:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>An animation or animator resource ID used for the enter animation on the view of the fragment being readded or reattached caused by <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack()">FragmentManager#popBackStack()</a></code> or similar methods.</p>
</td>
</tr>
<tr>
<td><code>popExit:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>An animation or animator resource ID used for the enter animation on the view of the fragment being removed or detached caused by <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#popBackStack()">FragmentManager#popBackStack()</a></code> or similar methods.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setMaxLifecycle(androidx.fragment.app.Fragment, androidx.lifecycle.Lifecycle.State)"></a><a name="setMaxLifecycle-androidx.fragment.app.Fragment-androidx.lifecycle.Lifecycle.State-"></a>
<h3 class="api-name" id="setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)">setMaxLifecycle</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)">setMaxLifecycle</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>,&nbsp;state:&nbsp;State):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Set a ceiling for the state of an active fragment in this FragmentManager. If fragment is already above the received state, it will be forced down to the correct state. </p>
<p>The fragment provided must currently be added to the FragmentManager to have it's Lifecycle state capped, or previously added as part of this transaction. If the Lifecycle.State#INITIALIZED is passed in as the Lifecycle.State and the provided fragment has already moved beyond Lifecycle.State#INITIALIZED, an <code><a href="https://developer.android.com/reference/java/lang/IllegalArgumentException.html">IllegalArgumentException</a></code> will be thrown.</p>
<p>If the Lifecycle.State#DESTROYED is passed in as the Lifecycle.State an <code><a href="https://developer.android.com/reference/java/lang/IllegalArgumentException.html">IllegalArgumentException</a></code> will be thrown.</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>the same FragmentTransaction instance</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 to have it's state capped.</p>
</td>
</tr>
<tr>
<td><code>state:&nbsp;State</code></td>
<td width="100%">
<p>the ceiling state for the fragment.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setPrimaryNavigationFragment-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="setPrimaryNavigationFragment(androidx.fragment.app.Fragment)">setPrimaryNavigationFragment</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setPrimaryNavigationFragment(androidx.fragment.app.Fragment)">setPrimaryNavigationFragment</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Set a currently active fragment in this FragmentManager as the primary navigation fragment. </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()">FragmentManager#popBackStack()</a></code> if no ID or transaction name is provided to pop to. Navigation operations outside of the fragment system may choose to delegate those actions to the primary navigation fragment as returned by <code><a href="/reference/kotlin/androidx/fragment/app/FragmentManager.html#getPrimaryNavigationFragment()">FragmentManager#getPrimaryNavigationFragment()</a></code>.</p>
<p>The fragment provided must currently be added to the FragmentManager to be set as a primary navigation fragment, or previously added as part of this transaction.</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>the same FragmentTransaction instance</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 to set as the primary navigation fragment</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setReorderingAllowed-boolean-"></a>
<h3 class="api-name" id="setReorderingAllowed(boolean)">setReorderingAllowed</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setReorderingAllowed(boolean)">setReorderingAllowed</a>(reorderingAllowed:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Sets whether or not to allow optimizing operations within and across transactions. This will remove redundant operations, eliminating operations that cancel. For example, if two transactions are executed together, one that adds a fragment A and the next replaces it with fragment B, the operations will cancel and only fragment B will be added. That means that fragment A may not go through the creation/destruction lifecycle. </p>
<p>The side effect of removing redundant operations is that fragments may have state changes out of the expected order. For example, one transaction adds fragment A, a second adds fragment B, then a third removes fragment A. Without removing the redundant operations, fragment B could expect that while it is being created, fragment A will also exist because fragment A will be removed after fragment B was added. With removing redundant operations, fragment B cannot expect fragment A to exist when it has been created because fragment A's add/remove will be optimized out. </p>
<p>It can also reorder the state changes of Fragments to allow for better Transitions. Added Fragments may have <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html#onCreate(android.os.Bundle)">Fragment#onCreate(Bundle)</a></code> called before replaced Fragments have <code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html#onDestroy()">Fragment#onDestroy()</a></code> called. </p>
<p><code><a href="/reference/kotlin/androidx/fragment/app/Fragment.html#postponeEnterTransition()">Fragment#postponeEnterTransition()</a></code> requires <code>{@code setReorderingAllowed(true)}</code>. </p>
<p>The default is <code>{@code false}</code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>reorderingAllowed:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td width="100%">
<p><code>{@code true}</code> to enable optimizing out redundant operations or <code>{@code false}</code> to disable optimizing out redundant operations on this transaction.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setTransition-int-"></a>
<h3 class="api-name" id="setTransition(int)">setTransition</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setTransition(int)">setTransition</a>(transition:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Select a standard transition animation for this transaction. May be one of <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_NONE()">TRANSIT_NONE</a></code>, <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_FRAGMENT_OPEN()">TRANSIT_FRAGMENT_OPEN</a></code>, <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_FRAGMENT_CLOSE()">TRANSIT_FRAGMENT_CLOSE</a></code>, or <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_FRAGMENT_FADE()">TRANSIT_FRAGMENT_FADE</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>transition:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td width="100%">
<p>Value is <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_NONE()">TRANSIT_NONE</a></code>, <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_FRAGMENT_OPEN()">TRANSIT_FRAGMENT_OPEN</a></code>, <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_FRAGMENT_CLOSE()">TRANSIT_FRAGMENT_CLOSE</a></code>, or <code><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#TRANSIT_FRAGMENT_FADE()">TRANSIT_FRAGMENT_FADE</a></code></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setTransitionStyle-int-"></a>
<h3 class="api-name" id="setTransitionStyle(int)">setTransitionStyle</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<span><del><a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#setTransitionStyle(int)">setTransitionStyle</a></del></span>(styleRes:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<aside class="caution"><strong>This function is deprecated.</strong><br>
<p>The desired functionality never worked correctly. This should not be used.</p>
</aside>
<p>Set a custom style resource that will be used for resolving transit animations.</p>
</div>
<div><a name="show-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="show(androidx.fragment.app.Fragment)">show</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html#show(androidx.fragment.app.Fragment)">show</a>(fragment:&nbsp;<a href="/reference/kotlin/androidx/fragment/app/Fragment.html">Fragment</a>):&nbsp;<a href="/reference/kotlin/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></pre>
<p>Shows a previously hidden fragment. This is only relevant for fragments whose views have been added to a container, as this will cause the view to be shown.</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/FragmentTransaction.html">FragmentTransaction</a></code></td>
<td width="100%">
<p>Returns the same FragmentTransaction instance.</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 to be shown.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>