blob: 0765fd8e5a5ce1e8323250fb14a74216c789b3aa [file] [log] [blame]
<html devsite="true">
<head>
<title>Fragment</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>Fragment</h1>
{% setvar page_path %}androidx/fragment/app/Fragment.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_java_switcher2.md" %}
<p>
<pre>public class Fragment</pre>
</p>
<div class="devsite-table-wrapper"><devsite-expandable><span class="expand-control jd-sumtable-subclasses">Known direct subclasses
<div class="showalways" id="subclasses-direct"><a href="/reference/androidx/fragment/app/DialogFragment.html">DialogFragment</a>, <a href="/reference/androidx/fragment/app/ListFragment.html">ListFragment</a></div>
</span>
<div id="subclasses-direct-summary">
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td><code><a href="/reference/androidx/fragment/app/DialogFragment.html">DialogFragment</a></code></td>
<td width="100%">
<p>Static library support version of the framework's android.app.DialogFragment.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/androidx/fragment/app/ListFragment.html">ListFragment</a></code></td>
<td width="100%">
<p>Static library support version of the framework's android.app.ListFragment.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</devsite-expandable> </div>
<hr>
<p>Static library support version of the framework's android.app.Fragment. 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 android.app.Fragment documentation for a class overview. </p>
<p>The main differences when using this support version instead of the framework version are: </p>
<ul>
<li>Your activity must extend <code><a href="/reference/androidx/fragment/app/FragmentActivity.html">FragmentActivity</a></code></li>
<li>You must call <code><a href="/reference/androidx/fragment/app/FragmentActivity.html#getSupportFragmentManager()">FragmentActivity#getSupportFragmentManager</a></code> to get the <code><a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code></li>
</ul>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Nested types</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/androidx/fragment/app/Fragment.InstantiationException.html">Fragment.InstantiationException</a></code></td>
<td width="100%">
<p>Thrown by <code><a href="/reference/androidx/fragment/app/FragmentFactory.html#instantiate(java.lang.ClassLoader,java.lang.String)">FragmentFactory#instantiate(ClassLoader, String)</a></code> when there is an instantiation failure.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/androidx/fragment/app/Fragment.SavedState.html">Fragment.SavedState</a></code></td>
<td width="100%">
<p>State information that has been retrieved from a fragment instance through <code><a href="/reference/androidx/fragment/app/FragmentManager.html#saveFragmentInstanceState(androidx.fragment.app.Fragment)">FragmentManager.saveFragmentInstanceState</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#Fragment()">Fragment</a>()</code></div>
<p>Constructor used by the default <code><a href="/reference/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a></code>.</p>
</td>
</tr>
<tr>
<td>
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#Fragment(int)">Fragment</a>(int&nbsp;contentLayoutId)</code></div>
<p>Alternate constructor that can be called from your default, no argument constructor to provide a default layout that will be inflated by <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Public methods</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[])">dump</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;prefix,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/io/FileDescriptor.html">FileDescriptor</a>&nbsp;fd,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/io/PrintWriter.html">PrintWriter</a>&nbsp;writer,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&gt;&nbsp;args<br>)</code></div>
<p>Print the Fragments's state into the given stream.</p>
</td>
</tr>
<tr>
<td><code>final boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#equals(java.lang.Object)">equals</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;o)</code></div>
<p>Subclasses can not override equals().</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentActivity.html">FragmentActivity</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getActivity()">getActivity</a>()</code></div>
<p>Return the <code><a href="/reference/androidx/fragment/app/FragmentActivity.html">FragmentActivity</a></code> this fragment is currently associated with.</p>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getAllowEnterTransitionOverlap()">getAllowEnterTransitionOverlap</a>()</code></div>
<p>Returns whether the the exit transition and enter transition overlap or not.</p>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getAllowReturnTransitionOverlap()">getAllowReturnTransitionOverlap</a>()</code></div>
<p>Returns whether the the return transition and reenter transition overlap or not.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getArguments()">getArguments</a>()</code></div>
<p>Return the arguments supplied when the fragment was instantiated, if any.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getChildFragmentManager()">getChildFragmentManager</a>()</code></div>
<p>Return a private FragmentManager for placing and managing Fragments inside of this Fragment.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Context</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getContext()">getContext</a>()</code></div>
<p>Return the Context this fragment is currently associated with.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Factory</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getDefaultViewModelProviderFactory()">getDefaultViewModelProviderFactory</a>()</code></div>
<p>The <code><a href="/reference/androidx/fragment/app/Fragment.html#getArguments()">Fragment's arguments</a></code> when this is first called will be used as the defaults to any androidx.lifecycle.SavedStateHandle passed to a view model created using this factory.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getEnterTransition()">getEnterTransition</a>()</code></div>
<p>Returns the Transition that will be used to move Views into the initial scene.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getExitTransition()">getExitTransition</a>()</code></div>
<p>Returns the Transition that will be used to move Views out of the scene when the fragment is removed, hidden, or detached when not popping the back stack.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#getFragmentManager()">getFragmentManager</a></del></span>()</code></div>
<p><strong>This method is deprecated.</strong>
<p>This has been removed in favor of <code>getParentFragmentManager()</code> which throws an <code><a href="https://developer.android.com/reference/java/lang/IllegalStateException.html">IllegalStateException</a></code> if the FragmentManager is null.</p>
</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getHost()">getHost</a>()</code></div>
<p>Return the host object of this fragment.</p>
</td>
</tr>
<tr>
<td><code>final int</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getId()">getId</a>()</code></div>
<p>Return the identifier this fragment is known by.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LayoutInflater</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getLayoutInflater()">getLayoutInflater</a>()</code></div>
<p>Returns the cached LayoutInflater used to inflate Views of this Fragment.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Lifecycle</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getLifecycle()">getLifecycle</a>()</code></div>
<p>Overriding this method is no longer supported and this method will be made <code>final</code> in a future version of Fragment.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LoaderManager</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#getLoaderManager()">getLoaderManager</a></del></span>()</code></div>
<p><strong>This method is deprecated.</strong>
<p>Use LoaderManager.getInstance(this).</p>
</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getParentFragment()">getParentFragment</a>()</code></div>
<p>Returns the parent Fragment containing this Fragment.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getParentFragmentManager()">getParentFragmentManager</a>()</code></div>
<p>Return the FragmentManager for interacting with fragments associated with this fragment's activity.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getReenterTransition()">getReenterTransition</a>()</code></div>
<p>Returns the Transition that will be used to move Views in to the scene when returning due to popping a back stack.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Resources</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getResources()">getResources</a>()</code></div>
<p>Return <code>requireActivity().getResources()</code>.</p>
</td>
</tr>
<tr>
<td><code>final boolean</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#getRetainInstance()">getRetainInstance</a></del></span>()</code></div>
<p><strong>This method is deprecated.</strong>
<p>Instead of retaining the Fragment itself, use a non-retained Fragment and keep retained state in a ViewModel attached to that Fragment.</p>
</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getReturnTransition()">getReturnTransition</a>()</code></div>
<p>Returns the Transition that will be used to move Views out of the scene when the Fragment is preparing to be removed, hidden, or detached because of popping the back stack.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;SavedStateRegistry</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getSavedStateRegistry()">getSavedStateRegistry</a>()</code></div>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getSharedElementEnterTransition()">getSharedElementEnterTransition</a>()</code></div>
<p>Returns the Transition that will be used for shared elements transferred into the content Scene.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getSharedElementReturnTransition()">getSharedElementReturnTransition</a>()</code></div>
<p>Return the Transition that will be used for shared elements transferred back during a pop of the back stack.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getString(int)">getString</a>(int&nbsp;resId)</code></div>
<p>Return a localized string from the application's package's default string table.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getString(int,java.lang.Object...)">getString</a>(int&nbsp;resId,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt;&nbsp;formatArgs)</code></div>
<p>Return a localized formatted string from the application's package's default string table, substituting the format arguments as defined in <code><a href="https://developer.android.com/reference/java/util/Formatter.html">java.util.Formatter</a></code> and format.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getTag()">getTag</a>()</code></div>
<p>Get the tag name of the fragment, if specified.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#getTargetFragment()">getTargetFragment</a></del></span>()</code></div>
<p><strong>This method is deprecated.</strong>
<p>Instead of using a target fragment to pass results, use <code><a href="/reference/androidx/fragment/app/FragmentManager.html#setFragmentResult(java.lang.String,android.os.Bundle)">FragmentManager#setFragmentResult(String, Bundle)</a></code> to deliver results to <code><a href="/reference/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code> instances registered by other fragments via <code><a href="/reference/androidx/fragment/app/FragmentManager.html#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)">FragmentManager#setFragmentResultListener(String, LifecycleOwner, FragmentResultListener)</a></code>.</p>
</p>
</td>
</tr>
<tr>
<td><code>final int</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#getTargetRequestCode()">getTargetRequestCode</a></del></span>()</code></div>
<p><strong>This method is deprecated.</strong>
<p>When using the target fragment replacement of <code><a href="/reference/androidx/fragment/app/FragmentManager.html#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)">FragmentManager#setFragmentResultListener(String, LifecycleOwner, FragmentResultListener)</a></code> and <code><a href="/reference/androidx/fragment/app/FragmentManager.html#setFragmentResult(java.lang.String,android.os.Bundle)">FragmentManager#setFragmentResult(String, Bundle)</a></code>, consider using <code><a href="/reference/androidx/fragment/app/Fragment.html#setArguments(android.os.Bundle)">setArguments</a></code> to pass a <code>{@code requestKey}</code> if you need to support dynamic request keys.</p>
</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/CharSequence.html">CharSequence</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getText(int)">getText</a>(int&nbsp;resId)</code></div>
<p>Return a localized, styled CharSequence from the application's package's default string table.</p>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#getUserVisibleHint()">getUserVisibleHint</a></del></span>()</code></div>
<p><strong>This method is deprecated.</strong>
<p>Use <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)">FragmentTransaction#setMaxLifecycle(Fragment, Lifecycle.State)</a></code> instead.</p>
</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;View</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getView()">getView</a>()</code></div>
<p>Get the root view for the fragment's layout (the one returned by <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code>), if provided.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LifecycleOwner</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getViewLifecycleOwner()">getViewLifecycleOwner</a>()</code></div>
<p>Get a LifecycleOwner that represents the <code><a href="/reference/androidx/fragment/app/Fragment.html#getView()">Fragment's View</a></code> lifecycle.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LiveData&lt;LifecycleOwner&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getViewLifecycleOwnerLiveData()">getViewLifecycleOwnerLiveData</a>()</code></div>
<p>Retrieve a LiveData which allows you to observe the <code><a href="/reference/androidx/fragment/app/Fragment.html#getViewLifecycleOwner()">lifecycle of the Fragment's View</a></code>.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;ViewModelStore</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getViewModelStore()">getViewModelStore</a>()</code></div>
<p>Returns the ViewModelStore associated with this Fragment </p>
<p>Overriding this method is no longer supported and this method will be made <code>final</code> in a future version of Fragment.</p>
</td>
</tr>
<tr>
<td><code>final int</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#hashCode()">hashCode</a>()</code></div>
<p>Subclasses can not override hashCode().</p>
</td>
</tr>
<tr>
<td><code>static @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#instantiate(android.content.Context,java.lang.String)">instantiate</a></del></span>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Context&nbsp;context,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;fname)</code></div>
<p><strong>This method is deprecated.</strong>
<p>Use <code><a href="/reference/androidx/fragment/app/FragmentManager.html#getFragmentFactory()">FragmentManager#getFragmentFactory()</a></code> and <code><a href="/reference/androidx/fragment/app/FragmentFactory.html#instantiate(java.lang.ClassLoader,java.lang.String)">FragmentFactory#instantiate(ClassLoader, String)</a></code></p>
</p>
</td>
</tr>
<tr>
<td><code>static @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#instantiate(android.content.Context,java.lang.String,android.os.Bundle)">instantiate</a></del></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Context&nbsp;context,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;fname,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;args<br>)</code></div>
<p><strong>This method is deprecated.</strong>
<p>Use <code><a href="/reference/androidx/fragment/app/FragmentManager.html#getFragmentFactory()">FragmentManager#getFragmentFactory()</a></code> and <code><a href="/reference/androidx/fragment/app/FragmentFactory.html#instantiate(java.lang.ClassLoader,java.lang.String)">FragmentFactory#instantiate(ClassLoader, String)</a></code>, manually calling <code><a href="/reference/androidx/fragment/app/Fragment.html#setArguments(android.os.Bundle)">setArguments</a></code> on the returned Fragment.</p>
</p>
</td>
</tr>
<tr>
<td><code>final boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#isAdded()">isAdded</a>()</code></div>
<p>Return true if the fragment is currently added to its activity.</p>
</td>
</tr>
<tr>
<td><code>final boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#isDetached()">isDetached</a>()</code></div>
<p>Return true if the fragment has been explicitly detached from the UI.</p>
</td>
</tr>
<tr>
<td><code>final boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#isHidden()">isHidden</a>()</code></div>
<p>Return true if the fragment has been hidden.</p>
</td>
</tr>
<tr>
<td><code>final boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#isInLayout()">isInLayout</a>()</code></div>
<p>Return true if the layout is included as part of an activity view hierarchy via the &lt;fragment&gt; tag.</p>
</td>
</tr>
<tr>
<td><code>final boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#isRemoving()">isRemoving</a>()</code></div>
<p>Return true if this fragment is currently being removed from its activity.</p>
</td>
</tr>
<tr>
<td><code>final boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#isResumed()">isResumed</a>()</code></div>
<p>Return true if the fragment is in the resumed state.</p>
</td>
</tr>
<tr>
<td><code>final boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#isStateSaved()">isStateSaved</a>()</code></div>
<p>Returns true if this fragment is added and its state has already been saved by its host.</p>
</td>
</tr>
<tr>
<td><code>final boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#isVisible()">isVisible</a>()</code></div>
<p>Return true if the fragment is currently visible to the user.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#onActivityCreated(android.os.Bundle)">onActivityCreated</a></del></span>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState)</code></div>
<p><strong>This method is deprecated.</strong>
<p>use <code><a href="/reference/androidx/fragment/app/Fragment.html#onViewCreated(android.view.View,android.os.Bundle)">onViewCreated</a></code> for code touching the Fragment's view and <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreate(android.os.Bundle)">onCreate</a></code> for other initialization.</p>
</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#onActivityResult(int,int,android.content.Intent)">onActivityResult</a></del></span>(int&nbsp;requestCode,&nbsp;int&nbsp;resultCode,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Intent&nbsp;data)</code></div>
<p><strong>This method is deprecated.</strong>
<p>use <code><a href="/reference/androidx/fragment/app/Fragment.html#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract&lt;I,O&gt;,androidx.activity.result.ActivityResultCallback&lt;O&gt;)">registerForActivityResult</a></code> with the appropriate ActivityResultContract and handling the result in the callback.</p>
</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.content.Context)">onAttach</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Context&nbsp;context)</code></div>
<p>Called when a fragment is first attached to its context.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.app.Activity)">onAttach</a></del></span>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Activity&nbsp;activity)</code></div>
<p><strong>This method is deprecated.</strong>
<p>See <code><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.content.Context)">onAttach</a></code>.</p>
</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#onAttachFragment(androidx.fragment.app.Fragment)">onAttachFragment</a></del></span>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a>&nbsp;childFragment)</code></div>
<p><strong>This method is deprecated.</strong>
<p>The responsibility for listening for fragments being attached has been moved to FragmentManager.</p>
</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onConfigurationChanged(android.content.res.Configuration)">onConfigurationChanged</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Configuration&nbsp;newConfig)</code></div>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onContextItemSelected(android.view.MenuItem)">onContextItemSelected</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;MenuItem&nbsp;item)</code></div>
<p>This hook is called whenever an item in a context menu is selected.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onCreate(android.os.Bundle)">onCreate</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState)</code></div>
<p>Called to do initial creation of a fragment.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Animation</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateAnimation(int,boolean,int)">onCreateAnimation</a>(int&nbsp;transit,&nbsp;boolean&nbsp;enter,&nbsp;int&nbsp;nextAnim)</code></div>
<p>Called when a fragment loads an animation.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Animator</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateAnimator(int,boolean,int)">onCreateAnimator</a>(int&nbsp;transit,&nbsp;boolean&nbsp;enter,&nbsp;int&nbsp;nextAnim)</code></div>
<p>Called when a fragment loads an animator.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateContextMenu(android.view.ContextMenu,android.view.View,android.view.ContextMenu.ContextMenuInfo)">onCreateContextMenu</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;ContextMenu&nbsp;menu,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;View&nbsp;v,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;ContextMenuInfo&nbsp;menuInfo<br>)</code></div>
<p>Called when a context menu for the <code>{@code view}</code> is about to be shown.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)">onCreateOptionsMenu</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Menu&nbsp;menu,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;MenuInflater&nbsp;inflater)</code></div>
<p>Initialize the contents of the Fragment host's standard options menu.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;View</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LayoutInflater&nbsp;inflater,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;ViewGroup&nbsp;container,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState<br>)</code></div>
<p>Called to have the fragment instantiate its user interface view.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onDestroy()">onDestroy</a>()</code></div>
<p>Called when the fragment is no longer in use.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onDestroyOptionsMenu()">onDestroyOptionsMenu</a>()</code></div>
<p>Called when this fragment's option menu items are no longer being included in the overall options menu.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onDestroyView()">onDestroyView</a>()</code></div>
<p>Called when the view previously created by <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code> has been detached from the fragment.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onDetach()">onDetach</a>()</code></div>
<p>Called when the fragment is no longer attached to its activity.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LayoutInflater</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onGetLayoutInflater(android.os.Bundle)">onGetLayoutInflater</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState)</code></div>
<p>Returns the LayoutInflater used to inflate Views of this Fragment.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onHiddenChanged(boolean)">onHiddenChanged</a>(boolean&nbsp;hidden)</code></div>
<p>Called when the hidden state (as returned by <code><a href="/reference/androidx/fragment/app/Fragment.html#isHidden()">isHidden</a></code> of the fragment has changed.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onInflate(android.content.Context,android.util.AttributeSet,android.os.Bundle)">onInflate</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Context&nbsp;context,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;AttributeSet&nbsp;attrs,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState<br>)</code></div>
<p>Called when a fragment is being created as part of a view layout inflation, typically from setting the content view of an activity.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#onInflate(android.app.Activity,android.util.AttributeSet,android.os.Bundle)">onInflate</a></del></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Activity&nbsp;activity,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;AttributeSet&nbsp;attrs,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState<br>)</code></div>
<p><strong>This method is deprecated.</strong>
<p>See <code><a href="/reference/androidx/fragment/app/Fragment.html#onInflate(android.content.Context,android.util.AttributeSet,android.os.Bundle)">onInflate</a></code>.</p>
</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onLowMemory()">onLowMemory</a>()</code></div>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onMultiWindowModeChanged(boolean)">onMultiWindowModeChanged</a>(boolean&nbsp;isInMultiWindowMode)</code></div>
<p>Called when the Fragment's activity changes from fullscreen mode to multi-window mode and visa-versa.</p>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onOptionsItemSelected(android.view.MenuItem)">onOptionsItemSelected</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;MenuItem&nbsp;item)</code></div>
<p>This hook is called whenever an item in your options menu is selected.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onOptionsMenuClosed(android.view.Menu)">onOptionsMenuClosed</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Menu&nbsp;menu)</code></div>
<p>This hook is called whenever the options menu is being closed (either by the user canceling the menu with the back/menu button, or when an item is selected).</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onPause()">onPause</a>()</code></div>
<p>Called when the Fragment is no longer resumed.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onPictureInPictureModeChanged(boolean)">onPictureInPictureModeChanged</a>(boolean&nbsp;isInPictureInPictureMode)</code></div>
<p>Called by the system when the activity changes to and from picture-in-picture mode.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onPrepareOptionsMenu(android.view.Menu)">onPrepareOptionsMenu</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Menu&nbsp;menu)</code></div>
<p>Prepare the Fragment host's standard options menu to be displayed.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onPrimaryNavigationFragmentChanged(boolean)">onPrimaryNavigationFragmentChanged</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;boolean&nbsp;isPrimaryNavigationFragment<br>)</code></div>
<p>Callback for when the primary navigation state of this Fragment has changed.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#onRequestPermissionsResult(int,java.lang.String[],int[])">onRequestPermissionsResult</a></del></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;requestCode,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&gt;&nbsp;permissions,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;int&gt;&nbsp;grantResults<br>)</code></div>
<p><strong>This method is deprecated.</strong>
<p>use <code><a href="/reference/androidx/fragment/app/Fragment.html#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract&lt;I,O&gt;,androidx.activity.result.ActivityResultCallback&lt;O&gt;)">registerForActivityResult</a></code> passing in a RequestMultiplePermissions object for the ActivityResultContract and handling the result in the callback.</p>
</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onResume()">onResume</a>()</code></div>
<p>Called when the fragment is visible to the user and actively running.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onSaveInstanceState(android.os.Bundle)">onSaveInstanceState</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Bundle&nbsp;outState)</code></div>
<p>Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance if its process is restarted.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onStart()">onStart</a>()</code></div>
<p>Called when the Fragment is visible to the user.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onStop()">onStop</a>()</code></div>
<p>Called when the Fragment is no longer started.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onViewCreated(android.view.View,android.os.Bundle)">onViewCreated</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;View&nbsp;view,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState)</code></div>
<p>Called immediately after <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code> has returned, but before any saved state has been restored in to the view.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onViewStateRestored(android.os.Bundle)">onViewStateRestored</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState)</code></div>
<p>Called when all saved state has been restored into the view hierarchy of the fragment.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#postponeEnterTransition()">postponeEnterTransition</a>()</code></div>
<p>Postpone the entering Fragment transition until <code><a href="/reference/androidx/fragment/app/Fragment.html#startPostponedEnterTransition()">startPostponedEnterTransition</a></code> or <code><a href="/reference/androidx/fragment/app/FragmentManager.html#executePendingTransactions()">FragmentManager#executePendingTransactions()</a></code> has been called.</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#postponeEnterTransition(long,java.util.concurrent.TimeUnit)">postponeEnterTransition</a>(long&nbsp;duration,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/util/concurrent/TimeUnit.html">TimeUnit</a>&nbsp;timeUnit)</code></div>
<p>Postpone the entering Fragment transition for a given amount of time and then call <code><a href="/reference/androidx/fragment/app/Fragment.html#startPostponedEnterTransition()">startPostponedEnterTransition</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;ActivityResultLauncher&lt;I&gt;</code></td>
<td width="100%">
<div><code>&lt;I,&nbsp;O&gt; <a href="/reference/androidx/fragment/app/Fragment.html#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract&lt;I,O&gt;,androidx.activity.result.ActivityResultCallback&lt;O&gt;)">registerForActivityResult</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;ActivityResultContract&lt;I, O&gt;&nbsp;contract,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;ActivityResultCallback&lt;O&gt;&nbsp;callback<br>)</code></div>
<p>If the host of this fragment is an ActivityResultRegistryOwner the ActivityResultRegistry of the host will be used.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;ActivityResultLauncher&lt;I&gt;</code></td>
<td width="100%">
<div><code>&lt;I,&nbsp;O&gt; <a href="/reference/androidx/fragment/app/Fragment.html#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract&lt;I,O&gt;,androidx.activity.result.ActivityResultRegistry,androidx.activity.result.ActivityResultCallback&lt;O&gt;)">registerForActivityResult</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;ActivityResultContract&lt;I, O&gt;&nbsp;contract,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;ActivityResultRegistry&nbsp;registry,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;ActivityResultCallback&lt;O&gt;&nbsp;callback<br>)</code></div>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#registerForContextMenu(android.view.View)">registerForContextMenu</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;View&nbsp;view)</code></div>
<p>Registers a context menu to be shown for the given view (multiple views can show the context menu).</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#requestPermissions(java.lang.String[],int)">requestPermissions</a></del></span>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&gt;&nbsp;permissions,&nbsp;int&nbsp;requestCode)</code></div>
<p><strong>This method is deprecated.</strong>
<p>use <code><a href="/reference/androidx/fragment/app/Fragment.html#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract&lt;I,O&gt;,androidx.activity.result.ActivityResultCallback&lt;O&gt;)">registerForActivityResult</a></code> passing in a RequestMultiplePermissions object for the ActivityResultContract and handling the result in the callback.</p>
</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentActivity.html">FragmentActivity</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#requireActivity()">requireActivity</a>()</code></div>
<p>Return the <code><a href="/reference/androidx/fragment/app/FragmentActivity.html">FragmentActivity</a></code> this fragment is currently associated with.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Bundle</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#requireArguments()">requireArguments</a>()</code></div>
<p>Return the arguments supplied when the fragment was instantiated.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Context</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#requireContext()">requireContext</a>()</code></div>
<p>Return the Context this fragment is currently associated with.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#requireFragmentManager()">requireFragmentManager</a></del></span>()</code></div>
<p><strong>This method is deprecated.</strong>
<p>This has been renamed to <code>getParentFragmentManager()</code> to make it clear that you are accessing the FragmentManager that contains this Fragment and not the FragmentManager associated with child Fragments.</p>
</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#requireHost()">requireHost</a>()</code></div>
<p>Return the host object of this fragment.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#requireParentFragment()">requireParentFragment</a>()</code></div>
<p>Returns the parent Fragment containing this Fragment.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;View</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#requireView()">requireView</a>()</code></div>
<p>Get the root view for the fragment's layout (the one returned by <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code>).</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setAllowEnterTransitionOverlap(boolean)">setAllowEnterTransitionOverlap</a>(boolean&nbsp;allow)</code></div>
<p>Sets whether the the exit transition and enter transition overlap or not.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setAllowReturnTransitionOverlap(boolean)">setAllowReturnTransitionOverlap</a>(boolean&nbsp;allow)</code></div>
<p>Sets whether the the return transition and reenter transition overlap or not.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setArguments(android.os.Bundle)">setArguments</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;args)</code></div>
<p>Supply the construction arguments for this fragment.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setEnterSharedElementCallback(androidx.core.app.SharedElementCallback)">setEnterSharedElementCallback</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;SharedElementCallback&nbsp;callback)</code></div>
<p>When custom transitions are used with Fragments, the enter transition callback is called when this Fragment is attached or detached when not popping the back stack.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setEnterTransition(java.lang.Object)">setEnterTransition</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;transition)</code></div>
<p>Sets the Transition that will be used to move Views into the initial scene.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setExitSharedElementCallback(androidx.core.app.SharedElementCallback)">setExitSharedElementCallback</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;SharedElementCallback&nbsp;callback)</code></div>
<p>When custom transitions are used with Fragments, the exit transition callback is called when this Fragment is attached or detached when popping the back stack.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setExitTransition(java.lang.Object)">setExitTransition</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;transition)</code></div>
<p>Sets the Transition that will be used to move Views out of the scene when the fragment is removed, hidden, or detached when not popping the back stack.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setHasOptionsMenu(boolean)">setHasOptionsMenu</a>(boolean&nbsp;hasMenu)</code></div>
<p>Report that this fragment would like to participate in populating the options menu by receiving a call to <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)">onCreateOptionsMenu</a></code> and related methods.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setInitialSavedState(androidx.fragment.app.Fragment.SavedState)">setInitialSavedState</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.SavedState.html">Fragment.SavedState</a>&nbsp;state)</code></div>
<p>Set the initial saved state that this Fragment should restore itself from when first being constructed, as returned by <code><a href="/reference/androidx/fragment/app/FragmentManager.html#saveFragmentInstanceState(androidx.fragment.app.Fragment)">FragmentManager.saveFragmentInstanceState</a></code>.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setMenuVisibility(boolean)">setMenuVisibility</a>(boolean&nbsp;menuVisible)</code></div>
<p>Set a hint for whether this fragment's menu should be visible.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setReenterTransition(java.lang.Object)">setReenterTransition</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;transition)</code></div>
<p>Sets the Transition that will be used to move Views in to the scene when returning due to popping a back stack.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#setRetainInstance(boolean)">setRetainInstance</a></del></span>(boolean&nbsp;retain)</code></div>
<p><strong>This method is deprecated.</strong>
<p>Instead of retaining the Fragment itself, use a non-retained Fragment and keep retained state in a ViewModel attached to that Fragment.</p>
</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setReturnTransition(java.lang.Object)">setReturnTransition</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;transition)</code></div>
<p>Sets the Transition that will be used to move Views out of the scene when the Fragment is preparing to be removed, hidden, or detached because of popping the back stack.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setSharedElementEnterTransition(java.lang.Object)">setSharedElementEnterTransition</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;transition)</code></div>
<p>Sets the Transition that will be used for shared elements transferred into the content Scene.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#setSharedElementReturnTransition(java.lang.Object)">setSharedElementReturnTransition</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;transition)</code></div>
<p>Sets the Transition that will be used for shared elements transferred back during a pop of the back stack.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#setTargetFragment(androidx.fragment.app.Fragment,int)">setTargetFragment</a></del></span>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a>&nbsp;fragment,&nbsp;int&nbsp;requestCode)</code></div>
<p><strong>This method is deprecated.</strong>
<p>Instead of using a target fragment to pass results, the fragment requesting a result should use <code><a href="/reference/androidx/fragment/app/FragmentManager.html#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)">FragmentManager#setFragmentResultListener(String, LifecycleOwner, FragmentResultListener)</a></code> to register a <code><a href="/reference/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code> with a <code>{@code * requestKey}</code> using its <code><a href="/reference/androidx/fragment/app/Fragment.html#getParentFragmentManager()">parent fragment manager</a></code>.</p>
</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#setUserVisibleHint(boolean)">setUserVisibleHint</a></del></span>(boolean&nbsp;isVisibleToUser)</code></div>
<p><strong>This method is deprecated.</strong>
<p>If you are manually calling this method, use <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)">FragmentTransaction#setMaxLifecycle(Fragment, Lifecycle.State)</a></code> instead.</p>
</p>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#shouldShowRequestPermissionRationale(java.lang.String)">shouldShowRequestPermissionRationale</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;permission)</code></div>
<p>Gets whether you should show UI with rationale before requesting a permission.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#startActivity(android.content.Intent)">startActivity</a>(Intent&nbsp;intent)</code></div>
<p>Call Activity#startActivity(Intent) from the fragment's containing Activity.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#startActivity(android.content.Intent,android.os.Bundle)">startActivity</a>(Intent&nbsp;intent,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;options)</code></div>
<p>Call Activity#startActivity(Intent, Bundle) from the fragment's containing Activity.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#startActivityForResult(android.content.Intent,int)">startActivityForResult</a></del></span>(Intent&nbsp;intent,&nbsp;int&nbsp;requestCode)</code></div>
<p><strong>This method is deprecated.</strong>
<p>use <code><a href="/reference/androidx/fragment/app/Fragment.html#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract&lt;I,O&gt;,androidx.activity.result.ActivityResultCallback&lt;O&gt;)">registerForActivityResult</a></code> passing in a StartActivityForResult object for the ActivityResultContract.</p>
</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#startActivityForResult(android.content.Intent,int,android.os.Bundle)">startActivityForResult</a></del></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;Intent&nbsp;intent,<br>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;requestCode,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;options<br>)</code></div>
<p><strong>This method is deprecated.</strong>
<p>use <code><a href="/reference/androidx/fragment/app/Fragment.html#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract&lt;I,O&gt;,androidx.activity.result.ActivityResultCallback&lt;O&gt;)">registerForActivityResult</a></code> passing in a StartActivityForResult object for the ActivityResultContract.</p>
</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/fragment/app/Fragment.html#startIntentSenderForResult(android.content.IntentSender,int,android.content.Intent,int,int,int,android.os.Bundle)">startIntentSenderForResult</a></del></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;IntentSender&nbsp;intent,<br>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;requestCode,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Intent&nbsp;fillInIntent,<br>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;flagsMask,<br>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;flagsValues,<br>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;extraFlags,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;options<br>)</code></div>
<p><strong>This method is deprecated.</strong>
<p>use <code><a href="/reference/androidx/fragment/app/Fragment.html#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract&lt;I,O&gt;,androidx.activity.result.ActivityResultCallback&lt;O&gt;)">registerForActivityResult</a></code> passing in a StartIntentSenderForResult object for the ActivityResultContract.</p>
</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#startPostponedEnterTransition()">startPostponedEnterTransition</a>()</code></div>
<p>Begin postponed transitions after <code><a href="/reference/androidx/fragment/app/Fragment.html#postponeEnterTransition()">postponeEnterTransition</a></code> was called.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#toString()">toString</a>()</code></div>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#unregisterForContextMenu(android.view.View)">unregisterForContextMenu</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;View&nbsp;view)</code></div>
<p>Prevents a context menu to be shown for the given view.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Public constructors</h2>
<div><a name="Fragment--"></a>
<h3 class="api-name" id="Fragment()">Fragment</h3>
<pre class="api-signature no-pretty-print">public&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#Fragment()">Fragment</a>()</pre>
<p>Constructor used by the default <code><a href="/reference/androidx/fragment/app/FragmentFactory.html">FragmentFactory</a></code>. You must <code><a href="/reference/androidx/fragment/app/FragmentManager.html#setFragmentFactory(androidx.fragment.app.FragmentFactory)">set a custom FragmentFactory</a></code> if you want to use a non-default constructor to ensure that your constructor is called when the fragment is re-instantiated. </p>
<p>It is strongly recommended to supply arguments with <code><a href="/reference/androidx/fragment/app/Fragment.html#setArguments(android.os.Bundle)">setArguments</a></code> and later retrieved by the Fragment with <code><a href="/reference/androidx/fragment/app/Fragment.html#getArguments()">getArguments</a></code>. These arguments are automatically saved and restored alongside the Fragment. </p>
<p>Applications should generally not implement a constructor. Prefer <code><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.content.Context)">onAttach</a></code> instead. It is the first place application code can run where the fragment is ready to be used - the point where the fragment is actually associated with its context. Some applications may also want to implement onInflate to retrieve attributes from a layout resource, although note this happens when the fragment is attached.</p>
</div>
<div><a name="Fragment-int-"></a>
<h3 class="api-name" id="Fragment(int)">Fragment</h3>
<pre class="api-signature no-pretty-print">public&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#Fragment(int)">Fragment</a>(int&nbsp;contentLayoutId)</pre>
<p>Alternate constructor that can be called from your default, no argument constructor to provide a default layout that will be inflated by <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code>. </p>
<pre class="prettyprint">class MyFragment extends Fragment {
public MyFragment() {
super(R.layout.fragment_main);
}
}
</pre>
You must <code><a href="/reference/androidx/fragment/app/FragmentManager.html#setFragmentFactory(androidx.fragment.app.FragmentFactory)">set a custom FragmentFactory</a></code> if you want to use a non-default constructor to ensure that your constructor is called when the fragment is re-instantiated.
<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/androidx/fragment/app/Fragment.html#Fragment()">Fragment</a></code></td>
<td width="100%">
<p>#Fragment()</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code></td>
<td width="100%">
<p>#onCreateView(LayoutInflater, ViewGroup, Bundle)</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<h2>Public methods</h2>
<div><a name="dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[])"></a><a name="dump-java.lang.String-java.io.FileDescriptor-java.io.PrintWriter-java.lang.String[]-"></a>
<h3 class="api-name" id="dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[])">dump</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[])">dump</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;prefix,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/io/FileDescriptor.html">FileDescriptor</a>&nbsp;fd,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/io/PrintWriter.html">PrintWriter</a>&nbsp;writer,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&gt;&nbsp;args<br>)</pre>
<p>Print the Fragments's state into the given stream.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;prefix</code></td>
<td width="100%">
<p>Text to print at the front of each line.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/io/FileDescriptor.html">FileDescriptor</a>&nbsp;fd</code></td>
<td width="100%">
<p>The raw file descriptor that the dump is being sent to.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/io/PrintWriter.html">PrintWriter</a>&nbsp;writer</code></td>
<td width="100%">
<p>The PrintWriter to which you should dump your state. This will be closed for you after you return.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&gt;&nbsp;args</code></td>
<td width="100%">
<p>additional arguments to the dump request.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="equals-java.lang.Object-"></a>
<h3 class="api-name" id="equals(java.lang.Object)">equals</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#equals(java.lang.Object)">equals</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;o)</pre>
<p>Subclasses can not override equals().</p>
</div>
<div><a name="getActivity--"></a>
<h3 class="api-name" id="getActivity()">getActivity</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentActivity.html">FragmentActivity</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getActivity()">getActivity</a>()</pre>
<p>Return the <code><a href="/reference/androidx/fragment/app/FragmentActivity.html">FragmentActivity</a></code> this fragment is currently associated with. May return <code>{@code null}</code> if the fragment is associated with a Context instead.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">See also</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/androidx/fragment/app/Fragment.html#requireActivity()">requireActivity</a></code></td>
<td width="100%">
<p>#requireActivity()</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getAllowEnterTransitionOverlap--"></a>
<h3 class="api-name" id="getAllowEnterTransitionOverlap()">getAllowEnterTransitionOverlap</h3>
<pre class="api-signature no-pretty-print">public&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getAllowEnterTransitionOverlap()">getAllowEnterTransitionOverlap</a>()</pre>
<p>Returns whether the the exit transition and enter transition overlap or not. When true, the enter transition will start as soon as possible. When false, the enter transition will wait until the exit transition completes before starting.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<p>true when the enter transition should start as soon as possible or false to when it should wait until the exiting transition completes.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getAllowReturnTransitionOverlap--"></a>
<h3 class="api-name" id="getAllowReturnTransitionOverlap()">getAllowReturnTransitionOverlap</h3>
<pre class="api-signature no-pretty-print">public&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getAllowReturnTransitionOverlap()">getAllowReturnTransitionOverlap</a>()</pre>
<p>Returns whether the the return transition and reenter transition overlap or not. When true, the reenter transition will start as soon as possible. When false, the reenter transition will wait until the return transition completes before starting.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<p>true to start the reenter transition when possible or false to wait until the return transition completes.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getArguments--"></a>
<h3 class="api-name" id="getArguments()">getArguments</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getArguments()">getArguments</a>()</pre>
<p>Return the arguments supplied when the fragment was instantiated, if any.</p>
</div>
<div><a name="getChildFragmentManager--"></a>
<h3 class="api-name" id="getChildFragmentManager()">getChildFragmentManager</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getChildFragmentManager()">getChildFragmentManager</a>()</pre>
<p>Return a private FragmentManager for placing and managing Fragments inside of this Fragment.</p>
</div>
<div><a name="getContext--"></a>
<h3 class="api-name" id="getContext()">getContext</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Context&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getContext()">getContext</a>()</pre>
<p>Return the Context this fragment is currently associated with.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">See also</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/androidx/fragment/app/Fragment.html#requireContext()">requireContext</a></code></td>
<td width="100%">
<p>#requireContext()</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getDefaultViewModelProviderFactory--"></a>
<h3 class="api-name" id="getDefaultViewModelProviderFactory()">getDefaultViewModelProviderFactory</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Factory&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getDefaultViewModelProviderFactory()">getDefaultViewModelProviderFactory</a>()</pre>
<p>The <code><a href="/reference/androidx/fragment/app/Fragment.html#getArguments()">Fragment's arguments</a></code> when this is first called will be used as the defaults to any androidx.lifecycle.SavedStateHandle passed to a view model created using this factory.</p>
</div>
<div><a name="getEnterTransition--"></a>
<h3 class="api-name" id="getEnterTransition()">getEnterTransition</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getEnterTransition()">getEnterTransition</a>()</pre>
<p>Returns the Transition that will be used to move Views into the initial scene. The entering Views will be those that are regular Views or ViewGroups that have ViewGroup#isTransitionGroup return true. Typical Transitions will extend android.transition.Visibility as entering is governed by changing visibility from View#INVISIBLE to View#VISIBLE.</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/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<p>the Transition to use to move Views into the initial Scene.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getExitTransition--"></a>
<h3 class="api-name" id="getExitTransition()">getExitTransition</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getExitTransition()">getExitTransition</a>()</pre>
<p>Returns the Transition that will be used to move Views out of the scene when the fragment is removed, hidden, or detached when not popping the back stack. The exiting Views will be those that are regular Views or ViewGroups that have ViewGroup#isTransitionGroup return true. Typical Transitions will extend android.transition.Visibility as exiting is governed by changing visibility from View#VISIBLE to View#INVISIBLE. If transition is null, the views will remain unaffected.</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/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<p>the Transition to use to move Views out of the Scene when the Fragment is being closed not due to popping the back stack.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getFragmentManager--"></a>
<h3 class="api-name" id="getFragmentManager()">getFragmentManager</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#getFragmentManager()">getFragmentManager</a></del></span>()</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>This has been removed in favor of <code>getParentFragmentManager()</code> which throws an <code><a href="https://developer.android.com/reference/java/lang/IllegalStateException.html">IllegalStateException</a></code> if the FragmentManager is null. Check if <code><a href="/reference/androidx/fragment/app/Fragment.html#isAdded()">isAdded</a></code> returns <code>false</code> to determine if the FragmentManager is <code>null</code>.</p>
</aside>
<p>Return the FragmentManager for interacting with fragments associated with this fragment's activity. Note that this will be non-null slightly before <code><a href="/reference/androidx/fragment/app/Fragment.html#getActivity()">getActivity</a></code>, during the time from when the fragment is placed in a <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code> until it is committed and attached to its activity. </p>
<p>If this Fragment is a child of another Fragment, the FragmentManager returned here will be the parent's <code><a href="/reference/androidx/fragment/app/Fragment.html#getChildFragmentManager()">getChildFragmentManager</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">See also</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/androidx/fragment/app/Fragment.html#getParentFragmentManager()">getParentFragmentManager</a></code></td>
<td width="100%">
<p>#getParentFragmentManager()</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getHost--"></a>
<h3 class="api-name" id="getHost()">getHost</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getHost()">getHost</a>()</pre>
<p>Return the host object of this fragment. May return <code>{@code null}</code> if the fragment isn't currently being hosted.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">See also</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/androidx/fragment/app/Fragment.html#requireHost()">requireHost</a></code></td>
<td width="100%">
<p>#requireHost()</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getId--"></a>
<h3 class="api-name" id="getId()">getId</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;int&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getId()">getId</a>()</pre>
<p>Return the identifier this fragment is known by. This is either the android:id value supplied in a layout or the container view ID supplied when adding the fragment.</p>
</div>
<div><a name="getLayoutInflater--"></a>
<h3 class="api-name" id="getLayoutInflater()">getLayoutInflater</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LayoutInflater&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getLayoutInflater()">getLayoutInflater</a>()</pre>
<p>Returns the cached LayoutInflater used to inflate Views of this Fragment. If <code><a href="/reference/androidx/fragment/app/Fragment.html#onGetLayoutInflater(android.os.Bundle)">onGetLayoutInflater</a></code> has not been called <code><a href="/reference/androidx/fragment/app/Fragment.html#onGetLayoutInflater(android.os.Bundle)">onGetLayoutInflater</a></code> will be called with a <code>{@code null}</code> argument and that value will be cached. </p>
<p>The cached LayoutInflater will be replaced immediately prior to <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code> and cleared immediately after <code><a href="/reference/androidx/fragment/app/Fragment.html#onDetach()">onDetach</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LayoutInflater</code></td>
<td width="100%">
<p>The LayoutInflater used to inflate Views of this Fragment.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getLifecycle--"></a>
<h3 class="api-name" id="getLifecycle()">getLifecycle</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Lifecycle&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getLifecycle()">getLifecycle</a>()</pre>
<p>Overriding this method is no longer supported and this method will be made <code>final</code> in a future version of Fragment.</p>
</div>
<div><a name="getLoaderManager--"></a>
<h3 class="api-name" id="getLoaderManager()">getLoaderManager</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LoaderManager&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#getLoaderManager()">getLoaderManager</a></del></span>()</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>Use LoaderManager.getInstance(this).</p>
</aside>
<p>Return the LoaderManager for this fragment.</p>
</div>
<div><a name="getParentFragment--"></a>
<h3 class="api-name" id="getParentFragment()">getParentFragment</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getParentFragment()">getParentFragment</a>()</pre>
<p>Returns the parent Fragment containing this Fragment. If this Fragment is attached directly to an Activity, returns null.</p>
</div>
<div><a name="getParentFragmentManager--"></a>
<h3 class="api-name" id="getParentFragmentManager()">getParentFragmentManager</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getParentFragmentManager()">getParentFragmentManager</a>()</pre>
<p>Return the FragmentManager for interacting with fragments associated with this fragment's activity. Note that this will be available slightly before <code><a href="/reference/androidx/fragment/app/Fragment.html#getActivity()">getActivity</a></code>, during the time from when the fragment is placed in a <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a></code> until it is committed and attached to its activity. </p>
<p>If this Fragment is a child of another Fragment, the FragmentManager returned here will be the parent's <code><a href="/reference/androidx/fragment/app/Fragment.html#getChildFragmentManager()">getChildFragmentManager</a></code>.</p>
<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 not associated with a transaction or host.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getReenterTransition--"></a>
<h3 class="api-name" id="getReenterTransition()">getReenterTransition</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getReenterTransition()">getReenterTransition</a>()</pre>
<p>Returns the Transition that will be used to move Views in to the scene when returning due to popping a back stack. The entering Views will be those that are regular Views or ViewGroups that have ViewGroup#isTransitionGroup return true. Typical Transitions will extend android.transition.Visibility as exiting is governed by changing visibility from View#VISIBLE to View#INVISIBLE. If nothing is set, the default will be to use the same transition as <code><a href="/reference/androidx/fragment/app/Fragment.html#getExitTransition()">getExitTransition</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<p>the Transition to use to move Views into the scene when reentering from a previously-started Activity due to popping the back stack.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getResources--"></a>
<h3 class="api-name" id="getResources()">getResources</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Resources&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getResources()">getResources</a>()</pre>
<p>Return <code>requireActivity().getResources()</code>.</p>
</div>
<div><a name="getRetainInstance--"></a>
<h3 class="api-name" id="getRetainInstance()">getRetainInstance</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#getRetainInstance()">getRetainInstance</a></del></span>()</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>Instead of retaining the Fragment itself, use a non-retained Fragment and keep retained state in a ViewModel attached to that Fragment. The ViewModel's constructor and its onCleared() callback provide the signal for initial creation and final destruction of the retained state.</p>
</aside>
<p>Returns <code>true</code> if this fragment instance's state will be retained across configuration changes, and <code>false</code> if it will not.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<p>whether or not this fragment instance will be retained.</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/androidx/fragment/app/Fragment.html#setRetainInstance(boolean)">setRetainInstance</a></code></td>
<td width="100%">
<p>#setRetainInstance(boolean)</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getReturnTransition--"></a>
<h3 class="api-name" id="getReturnTransition()">getReturnTransition</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getReturnTransition()">getReturnTransition</a>()</pre>
<p>Returns the Transition that will be used to move Views out of the scene when the Fragment is preparing to be removed, hidden, or detached because of popping the back stack. The exiting Views will be those that are regular Views or ViewGroups that have ViewGroup#isTransitionGroup return true. Typical Transitions will extend android.transition.Visibility as entering is governed by changing visibility from View#VISIBLE to View#INVISIBLE. If nothing is set, the default will be to use the same transition as <code><a href="/reference/androidx/fragment/app/Fragment.html#getEnterTransition()">getEnterTransition</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<p>the Transition to use to move Views out of the Scene when the Fragment is preparing to close due to popping the back stack.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getSavedStateRegistry--"></a>
<h3 class="api-name" id="getSavedStateRegistry()">getSavedStateRegistry</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;SavedStateRegistry&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getSavedStateRegistry()">getSavedStateRegistry</a>()</pre>
</div>
<div><a name="getSharedElementEnterTransition--"></a>
<h3 class="api-name" id="getSharedElementEnterTransition()">getSharedElementEnterTransition</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getSharedElementEnterTransition()">getSharedElementEnterTransition</a>()</pre>
<p>Returns the Transition that will be used for shared elements transferred into the content Scene. Typical Transitions will affect size and location, such as android.transition.ChangeBounds. A null value will cause transferred shared elements to blink to the final position.</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/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<p>The Transition to use for shared elements transferred into the content Scene.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getSharedElementReturnTransition--"></a>
<h3 class="api-name" id="getSharedElementReturnTransition()">getSharedElementReturnTransition</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getSharedElementReturnTransition()">getSharedElementReturnTransition</a>()</pre>
<p>Return the Transition that will be used for shared elements transferred back during a pop of the back stack. This Transition acts in the leaving Fragment. Typical Transitions will affect size and location, such as android.transition.ChangeBounds. A null value will cause transferred shared elements to blink to the final position. If no value is set, the default will be to use the same value as <code><a href="/reference/androidx/fragment/app/Fragment.html#setSharedElementEnterTransition(java.lang.Object)">setSharedElementEnterTransition</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<p>The Transition to use for shared elements transferred out of the content Scene.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getString-int-"></a>
<h3 class="api-name" id="getString(int)">getString</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getString(int)">getString</a>(int&nbsp;resId)</pre>
<p>Return a localized string from the application's package's default string table.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>int&nbsp;resId</code></td>
<td width="100%">
<p>Resource id for the string</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getString(int, java.lang.Object...)"></a><a name="getString-int-java.lang.Object...-"></a>
<h3 class="api-name" id="getString(int,java.lang.Object...)">getString</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getString(int,java.lang.Object...)">getString</a>(int&nbsp;resId,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt;&nbsp;formatArgs)</pre>
<p>Return a localized formatted string from the application's package's default string table, substituting the format arguments as defined in <code><a href="https://developer.android.com/reference/java/util/Formatter.html">java.util.Formatter</a></code> and format.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>int&nbsp;resId</code></td>
<td width="100%">
<p>Resource id for the format string</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt;&nbsp;formatArgs</code></td>
<td width="100%">
<p>The format arguments that will be used for substitution.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getTag--"></a>
<h3 class="api-name" id="getTag()">getTag</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getTag()">getTag</a>()</pre>
<p>Get the tag name of the fragment, if specified.</p>
</div>
<div><a name="getTargetFragment--"></a>
<h3 class="api-name" id="getTargetFragment()">getTargetFragment</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a>&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#getTargetFragment()">getTargetFragment</a></del></span>()</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>Instead of using a target fragment to pass results, use <code><a href="/reference/androidx/fragment/app/FragmentManager.html#setFragmentResult(java.lang.String,android.os.Bundle)">FragmentManager#setFragmentResult(String, Bundle)</a></code> to deliver results to <code><a href="/reference/androidx/fragment/app/FragmentResultListener.html">FragmentResultListener</a></code> instances registered by other fragments via <code><a href="/reference/androidx/fragment/app/FragmentManager.html#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)">FragmentManager#setFragmentResultListener(String, LifecycleOwner, FragmentResultListener)</a></code>.</p>
</aside>
<p>Return the target fragment set by <code><a href="/reference/androidx/fragment/app/Fragment.html#setTargetFragment(androidx.fragment.app.Fragment,int)">setTargetFragment</a></code>.</p>
</div>
<div><a name="getTargetRequestCode--"></a>
<h3 class="api-name" id="getTargetRequestCode()">getTargetRequestCode</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;int&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#getTargetRequestCode()">getTargetRequestCode</a></del></span>()</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>When using the target fragment replacement of <code><a href="/reference/androidx/fragment/app/FragmentManager.html#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)">FragmentManager#setFragmentResultListener(String, LifecycleOwner, FragmentResultListener)</a></code> and <code><a href="/reference/androidx/fragment/app/FragmentManager.html#setFragmentResult(java.lang.String,android.os.Bundle)">FragmentManager#setFragmentResult(String, Bundle)</a></code>, consider using <code><a href="/reference/androidx/fragment/app/Fragment.html#setArguments(android.os.Bundle)">setArguments</a></code> to pass a <code>{@code requestKey}</code> if you need to support dynamic request keys.</p>
</aside>
<p>Return the target request code set by <code><a href="/reference/androidx/fragment/app/Fragment.html#setTargetFragment(androidx.fragment.app.Fragment,int)">setTargetFragment</a></code>.</p>
</div>
<div><a name="getText-int-"></a>
<h3 class="api-name" id="getText(int)">getText</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/CharSequence.html">CharSequence</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getText(int)">getText</a>(int&nbsp;resId)</pre>
<p>Return a localized, styled CharSequence from the application's package's default string table.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>int&nbsp;resId</code></td>
<td width="100%">
<p>Resource id for the CharSequence text</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getUserVisibleHint--"></a>
<h3 class="api-name" id="getUserVisibleHint()">getUserVisibleHint</h3>
<pre class="api-signature no-pretty-print">public&nbsp;boolean&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#getUserVisibleHint()">getUserVisibleHint</a></del></span>()</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>Use <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)">FragmentTransaction#setMaxLifecycle(Fragment, Lifecycle.State)</a></code> instead.</p>
</aside>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<p>The current value of the user-visible hint on this fragment.</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/androidx/fragment/app/Fragment.html#setUserVisibleHint(boolean)">setUserVisibleHint</a></code></td>
<td width="100%">
<p>#setUserVisibleHint(boolean)</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getView--"></a>
<h3 class="api-name" id="getView()">getView</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;View&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getView()">getView</a>()</pre>
<p>Get the root view for the fragment's layout (the one returned by <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code>), if provided.</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/androidx/annotation/Nullable.html">Nullable</a>&nbsp;View</code></td>
<td width="100%">
<p>The fragment's root view, or null if it has no layout.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getViewLifecycleOwner--"></a>
<h3 class="api-name" id="getViewLifecycleOwner()">getViewLifecycleOwner</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LifecycleOwner&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getViewLifecycleOwner()">getViewLifecycleOwner</a>()</pre>
<p>Get a LifecycleOwner that represents the <code><a href="/reference/androidx/fragment/app/Fragment.html#getView()">Fragment's View</a></code> lifecycle. In most cases, this mirrors the lifecycle of the Fragment itself, but in cases of <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#detach(androidx.fragment.app.Fragment)">detached</a></code> Fragments, the lifecycle of the Fragment can be considerably longer than the lifecycle of the View itself. </p>
<p>Namely, the lifecycle of the Fragment's View is: </p>
<ol>
<li>created after <code><a href="/reference/androidx/fragment/app/Fragment.html#onViewStateRestored(android.os.Bundle)">onViewStateRestored</a></code></li>
<li>started after <code><a href="/reference/androidx/fragment/app/Fragment.html#onStart()">onStart</a></code></li>
<li>resumed after <code><a href="/reference/androidx/fragment/app/Fragment.html#onResume()">onResume</a></code></li>
<li>paused before <code><a href="/reference/androidx/fragment/app/Fragment.html#onPause()">onPause</a></code></li>
<li>stopped before <code><a href="/reference/androidx/fragment/app/Fragment.html#onStop()">onStop</a></code></li>
<li>destroyed before <code><a href="/reference/androidx/fragment/app/Fragment.html#onDestroyView()">onDestroyView</a></code></li>
</ol>
The first method where it is safe to access the view lifecycle is <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code> under the condition that you must return a non-null view (an IllegalStateException will be thrown if you access the view lifecycle but don't return a non-null view).
<p>The view lifecycle remains valid through the call to <code><a href="/reference/androidx/fragment/app/Fragment.html#onDestroyView()">onDestroyView</a></code>, after which <code><a href="/reference/androidx/fragment/app/Fragment.html#getView()">getView</a></code> will return null, the view lifecycle will be destroyed, and this method will throw an IllegalStateException. Consider using <code><a href="/reference/androidx/fragment/app/Fragment.html#getViewLifecycleOwnerLiveData()">getViewLifecycleOwnerLiveData</a></code> or <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#runOnCommit(java.lang.Runnable)">FragmentTransaction#runOnCommit(Runnable)</a></code> to receive a callback for when the Fragment's view lifecycle is available. </p>
<p>This should only be called on the main thread. </p>
<p>Overriding this method is no longer supported and this method will be made <code>final</code> in a future version of Fragment.</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/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LifecycleOwner</code></td>
<td width="100%">
<p>A LifecycleOwner that represents the <code><a href="/reference/androidx/fragment/app/Fragment.html#getView()">Fragment's View</a></code> lifecycle.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Throws</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>java.lang.IllegalStateException</code></td>
<td width="100%">
<p>if the <code><a href="/reference/androidx/fragment/app/Fragment.html#getView()">Fragment's View is null</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getViewLifecycleOwnerLiveData--"></a>
<h3 class="api-name" id="getViewLifecycleOwnerLiveData()">getViewLifecycleOwnerLiveData</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LiveData&lt;LifecycleOwner&gt;&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getViewLifecycleOwnerLiveData()">getViewLifecycleOwnerLiveData</a>()</pre>
<p>Retrieve a LiveData which allows you to observe the <code><a href="/reference/androidx/fragment/app/Fragment.html#getViewLifecycleOwner()">lifecycle of the Fragment's View</a></code>. </p>
<p>This will be set to the new LifecycleOwner after <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code> returns a non-null View and will set to null after <code><a href="/reference/androidx/fragment/app/Fragment.html#onDestroyView()">onDestroyView</a></code>. </p>
<p>Overriding this method is no longer supported and this method will be made <code>final</code> in a future version of Fragment.</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/androidx/annotation/NonNull.html">NonNull</a>&nbsp;LiveData&lt;LifecycleOwner&gt;</code></td>
<td width="100%">
<p>A LiveData that changes in sync with <code><a href="/reference/androidx/fragment/app/Fragment.html#getViewLifecycleOwner()">getViewLifecycleOwner</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getViewModelStore--"></a>
<h3 class="api-name" id="getViewModelStore()">getViewModelStore</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;ViewModelStore&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#getViewModelStore()">getViewModelStore</a>()</pre>
<p>Returns the ViewModelStore associated with this Fragment </p>
<p>Overriding this method is no longer supported and this method will be made <code>final</code> in a future version of Fragment.</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/androidx/annotation/NonNull.html">NonNull</a>&nbsp;ViewModelStore</code></td>
<td width="100%">
<p>a <code>{@code ViewModelStore}</code></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 called before the Fragment is attached i.e., before onAttach().</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="hashCode--"></a>
<h3 class="api-name" id="hashCode()">hashCode</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;int&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#hashCode()">hashCode</a>()</pre>
<p>Subclasses can not override hashCode().</p>
</div>
<div><a name="instantiate(android.content.Context, java.lang.String)"></a><a name="instantiate-android.content.Context-java.lang.String-"></a>
<h3 class="api-name" id="instantiate(android.content.Context,java.lang.String)">instantiate</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;static&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a>&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#instantiate(android.content.Context,java.lang.String)">instantiate</a></del></span>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Context&nbsp;context,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;fname)</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>Use <code><a href="/reference/androidx/fragment/app/FragmentManager.html#getFragmentFactory()">FragmentManager#getFragmentFactory()</a></code> and <code><a href="/reference/androidx/fragment/app/FragmentFactory.html#instantiate(java.lang.ClassLoader,java.lang.String)">FragmentFactory#instantiate(ClassLoader, String)</a></code></p>
</aside>
<p>Like <code><a href="/reference/androidx/fragment/app/Fragment.html#instantiate(android.content.Context,java.lang.String,android.os.Bundle)">instantiate</a></code> but with a null argument Bundle.</p>
</div>
<div><a name="instantiate(android.content.Context, java.lang.String, android.os.Bundle)"></a><a name="instantiate-android.content.Context-java.lang.String-android.os.Bundle-"></a>
<h3 class="api-name" id="instantiate(android.content.Context,java.lang.String,android.os.Bundle)">instantiate</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a><br>public&nbsp;static&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a>&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#instantiate(android.content.Context,java.lang.String,android.os.Bundle)">instantiate</a></del></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Context&nbsp;context,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;fname,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;args<br>)</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>Use <code><a href="/reference/androidx/fragment/app/FragmentManager.html#getFragmentFactory()">FragmentManager#getFragmentFactory()</a></code> and <code><a href="/reference/androidx/fragment/app/FragmentFactory.html#instantiate(java.lang.ClassLoader,java.lang.String)">FragmentFactory#instantiate(ClassLoader, String)</a></code>, manually calling <code><a href="/reference/androidx/fragment/app/Fragment.html#setArguments(android.os.Bundle)">setArguments</a></code> on the returned Fragment.</p>
</aside>
<p>Create a new instance of a Fragment with the given class name. This is the same as calling its empty constructor, setting the <code><a href="https://developer.android.com/reference/java/lang/ClassLoader.html">ClassLoader</a></code> on the supplied arguments, then calling <code><a href="/reference/androidx/fragment/app/Fragment.html#setArguments(android.os.Bundle)">setArguments</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td width="100%">
<p>Returns a new fragment 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>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Context&nbsp;context</code></td>
<td width="100%">
<p>The calling context being used to instantiate the fragment. This is currently just used to get its ClassLoader.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;fname</code></td>
<td width="100%">
<p>The class name of the fragment to instantiate.</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;args</code></td>
<td width="100%">
<p>Bundle of arguments to supply to the fragment, which it can retrieve with <code><a href="/reference/androidx/fragment/app/Fragment.html#getArguments()">getArguments</a></code>. May be null.</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>androidx.fragment.app.Fragment.InstantiationException</code></td>
<td width="100%">
<p>If there is a failure in instantiating the given fragment class. This is a runtime exception; it is not normally expected to happen.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="isAdded--"></a>
<h3 class="api-name" id="isAdded()">isAdded</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#isAdded()">isAdded</a>()</pre>
<p>Return true if the fragment is currently added to its activity.</p>
</div>
<div><a name="isDetached--"></a>
<h3 class="api-name" id="isDetached()">isDetached</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#isDetached()">isDetached</a>()</pre>
<p>Return true if the fragment has been explicitly detached from the UI. That is, <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#detach(androidx.fragment.app.Fragment)">FragmentTransaction.detach(Fragment)</a></code> has been used on it.</p>
</div>
<div><a name="isHidden--"></a>
<h3 class="api-name" id="isHidden()">isHidden</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#isHidden()">isHidden</a>()</pre>
<p>Return true if the fragment has been hidden. By default fragments are shown. You can find out about changes to this state with <code><a href="/reference/androidx/fragment/app/Fragment.html#onHiddenChanged(boolean)">onHiddenChanged</a></code>. Note that the hidden state is orthogonal to other states -- that is, to be visible to the user, a fragment must be both started and not hidden.</p>
</div>
<div><a name="isInLayout--"></a>
<h3 class="api-name" id="isInLayout()">isInLayout</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#isInLayout()">isInLayout</a>()</pre>
<p>Return true if the layout is included as part of an activity view hierarchy via the &lt;fragment&gt; tag. This will always be true when fragments are created through the &lt;fragment&gt; tag, <em>except</em>in the case where an old fragment is restored from a previous state and it does not appear in the layout of the current state.</p>
</div>
<div><a name="isRemoving--"></a>
<h3 class="api-name" id="isRemoving()">isRemoving</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#isRemoving()">isRemoving</a>()</pre>
<p>Return true if this fragment is currently being removed from its activity. This is <em>not</em> whether its activity is finishing, but rather whether it is in the process of being removed from its activity.</p>
</div>
<div><a name="isResumed--"></a>
<h3 class="api-name" id="isResumed()">isResumed</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#isResumed()">isResumed</a>()</pre>
<p>Return true if the fragment is in the resumed state. This is true for the duration of <code><a href="/reference/androidx/fragment/app/Fragment.html#onResume()">onResume</a></code> and <code><a href="/reference/androidx/fragment/app/Fragment.html#onPause()">onPause</a></code> as well.</p>
</div>
<div><a name="isStateSaved--"></a>
<h3 class="api-name" id="isStateSaved()">isStateSaved</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#isStateSaved()">isStateSaved</a>()</pre>
<p>Returns true if this fragment is added and its state has already been saved by its host. Any operations that would change saved state should not be performed if this method returns true, and some operations such as <code><a href="/reference/androidx/fragment/app/Fragment.html#setArguments(android.os.Bundle)">setArguments</a></code> will fail.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<p>true if this fragment's state has already been saved by its host</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="isVisible--"></a>
<h3 class="api-name" id="isVisible()">isVisible</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#isVisible()">isVisible</a>()</pre>
<p>Return true if the fragment is currently visible to the user. This means it: (1) has been added, (2) has its view attached to the window, and (3) is not hidden.</p>
</div>
<div><a name="onActivityCreated-android.os.Bundle-"></a>
<h3 class="api-name" id="onActivityCreated(android.os.Bundle)">onActivityCreated</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#onActivityCreated(android.os.Bundle)">onActivityCreated</a></del></span>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState)</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>use <code><a href="/reference/androidx/fragment/app/Fragment.html#onViewCreated(android.view.View,android.os.Bundle)">onViewCreated</a></code> for code touching the Fragment's view and <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreate(android.os.Bundle)">onCreate</a></code> for other initialization. To get a callback specifically when a Fragment activity's Activity#onCreate(Bundle) is called, register a androidx.lifecycle.LifecycleObserver on the Activity's Lifecycle in <code><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.content.Context)">onAttach</a></code>, removing it when it receives the Lifecycle.State#CREATED callback.</p>
</aside>
<p>Called when the fragment's activity has been created and this fragment's view hierarchy instantiated. It can be used to do final initialization once these pieces are in place, such as retrieving views or restoring state. It is also useful for fragments that use <code><a href="/reference/androidx/fragment/app/Fragment.html#setRetainInstance(boolean)">setRetainInstance</a></code> to retain their instance, as this callback tells the fragment when it is fully associated with the new activity instance. This is called after <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code> and before <code><a href="/reference/androidx/fragment/app/Fragment.html#onViewStateRestored(android.os.Bundle)">onViewStateRestored</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState</code></td>
<td width="100%">
<p>If the fragment is being re-created from a previous saved state, this is the state.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="onActivityResult(int, int, android.content.Intent)"></a><a name="onActivityResult-int-int-android.content.Intent-"></a>
<h3 class="api-name" id="onActivityResult(int,int,android.content.Intent)">onActivityResult</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#onActivityResult(int,int,android.content.Intent)">onActivityResult</a></del></span>(int&nbsp;requestCode,&nbsp;int&nbsp;resultCode,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Intent&nbsp;data)</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>use <code><a href="/reference/androidx/fragment/app/Fragment.html#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract&lt;I,O&gt;,androidx.activity.result.ActivityResultCallback&lt;O&gt;)">registerForActivityResult</a></code> with the appropriate ActivityResultContract and handling the result in the callback.</p>
</aside>
<p>Receive the result from a previous call to <code><a href="/reference/androidx/fragment/app/Fragment.html#startActivityForResult(android.content.Intent,int)">startActivityForResult</a></code>. This follows the related Activity API as described there in Activity#onActivityResult(int, int, Intent).</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>int&nbsp;requestCode</code></td>
<td width="100%">
<p>The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from.</p>
</td>
</tr>
<tr>
<td><code>int&nbsp;resultCode</code></td>
<td width="100%">
<p>The integer result code returned by the child activity through its setResult().</p>
</td>
</tr>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Intent&nbsp;data</code></td>
<td width="100%">
<p>An Intent, which can return result data to the caller (various data can be attached to Intent &quot;extras&quot;).</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="onAttach-android.content.Context-"></a>
<h3 class="api-name" id="onAttach(android.content.Context)">onAttach</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.content.Context)">onAttach</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Context&nbsp;context)</pre>
<p>Called when a fragment is first attached to its context. <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreate(android.os.Bundle)">onCreate</a></code> will be called after this.</p>
</div>
<div><a name="onAttach-android.app.Activity-"></a>
<h3 class="api-name" id="onAttach(android.app.Activity)">onAttach</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.app.Activity)">onAttach</a></del></span>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Activity&nbsp;activity)</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>See <code><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.content.Context)">onAttach</a></code>.</p>
</aside>
<p>Called when a fragment is first attached to its activity. <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreate(android.os.Bundle)">onCreate</a></code> will be called after this.</p>
</div>
<div><a name="onAttachFragment-androidx.fragment.app.Fragment-"></a>
<h3 class="api-name" id="onAttachFragment(androidx.fragment.app.Fragment)">onAttachFragment</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<span><del><a href="/reference/androidx/fragment/app/Fragment.html#onAttachFragment(androidx.fragment.app.Fragment)">onAttachFragment</a></del></span>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a>&nbsp;childFragment)</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>
<p>The responsibility for listening for fragments being attached has been moved to FragmentManager. You can add a listener to <code><a href="/reference/androidx/fragment/app/Fragment.html#getChildFragmentManager()">getChildFragmentManager</a></code> the child FragmentManager} by calling <code><a href="/reference/androidx/fragment/app/FragmentManager.html#addFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener)">FragmentManager#addFragmentOnAttachListener(FragmentOnAttachListener)</a></code> in <code><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.content.Context)">onAttach</a></code> to get callbacks when a child fragment is attached.</p>
</aside>
<p>Called when a fragment is attached as a child of this fragment. </p>
<p>This is called after the attached fragment's <code>onAttach</code> and before the attached fragment's <code>onCreate</code> if the fragment has not yet had a previous call to <code>onCreate</code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a>&nbsp;childFragment</code></td>
<td width="100%">
<p>child fragment being attached</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="onConfigurationChanged-android.content.res.Configuration-"></a>
<h3 class="api-name" id="onConfigurationChanged(android.content.res.Configuration)">onConfigurationChanged</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#onConfigurationChanged(android.content.res.Configuration)">onConfigurationChanged</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;Configuration&nbsp;newConfig)</pre>
</div>
<div><a name="onContextItemSelected-android.view.MenuItem-"></a>
<h3 class="api-name" id="onContextItemSelected(android.view.MenuItem)">onContextItemSelected</h3>
<pre class="api-signature no-pretty-print">public&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#onContextItemSelected(android.view.MenuItem)">onContextItemSelected</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;MenuItem&nbsp;item)</pre>
<p>This hook is called whenever an item in a context menu is selected. The default implementation simply returns false to have the normal processing happen (calling the item's Runnable or sending a message to its Handler as appropriate). You can use this method for any items for which you would like to do processing without those other facilities. </p>
<p>Use MenuItem#getMenuInfo() to get extra information set by the View that added this menu item. </p>
<p>Derived classes should call through to the base class for it to perform the default menu handling.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<p>boolean Return false to allow normal context menu processing to proceed, true to consume it here.</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>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a>&nbsp;MenuItem&nbsp;item</code></td>
<td width="100%">
<p>The context menu item that was selected.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="onCreate-android.os.Bundle-"></a>
<h3 class="api-name" id="onCreate(android.os.Bundle)">onCreate</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#onCreate(android.os.Bundle)">onCreate</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState)</pre>
<p>Called to do initial creation of a fragment. This is called after <code><a href="/reference/androidx/fragment/app/Fragment.html#onAttach(android.app.Activity)">onAttach</a></code> and before <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code>. </p>
<p>Note that this can be called while the fragment's activity is still in the process of being created. As such, you can not rely on things like the activity's content view hierarchy being initialized at this point. If you want to do work once the activity itself is created, add a androidx.lifecycle.LifecycleObserver on the activity's Lifecycle, removing it when it receives the Lifecycle.State#CREATED callback. </p>
<p>Any restored child fragments will be created before the base <code>Fragment.onCreate</code> method returns.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Bundle&nbsp;savedInstanceState</code></td>
<td width="100%">
<p>If the fragment is being re-created from a previous saved state, this is the state.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="onCreateAnimation(int, boolean, int)"></a><a name="onCreateAnimation-int-boolean-int-"></a>
<h3 class="api-name" id="onCreateAnimation(int,boolean,int)">onCreateAnimation</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;Animation&nbsp;<a href="/reference/androidx/fragment/app/Fragment.html#onCreateAnimation(int,boolean,int)">onCreateAnimation</a>(int&nbsp;transit,&nbsp;boolean&nbsp;enter,&nbsp;int&nbsp;nextAnim)</pre>
<p>Called when a fragment loads an animation. Note that if <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#setCustomAnimations(int,int)">FragmentTransaction#setCustomAnimations(int, int)</a></code> was called with Animator resources instead of Animation resources, <code>{@code nextAnim}</code> will be an animator resource.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>int&nbsp;transit</code></td>
<td width="100%">
<p>The value set in <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#setTransition(int)">FragmentTransaction#setTransition(int)</a></code> or 0 if not set.</p>
</td>
</tr>
<tr>
<td><code>boolean&nbsp;enter</code></td>
<td width="100%">
<p><code>{@code true}</code> when the fragment is added/attached/shown or <code>{@code false}</code> when the fragment is removed/detached/hidden.</p>
</td>
</tr>
<tr>
<td><code>int&nbsp;nextAnim</code></td>
<td width="100%">
<p>The resource set in <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#setCustomAnimations(int,int)">FragmentTransaction#setCustomAnimations(int, int)</a></code>, <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#setCustomAnimations(int,int,int,int)">FragmentTransaction#setCustomAnimations(int, int, int, int)</a></code>, or 0 if neither was called. The value will depend on the current operation.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="onCreateAnimator(int, boolean, int)"></a><a name="onCreateAnimator-int-boolean-int-"></a>
<h3 class=