blob: 8963999cb254a2fd27c27079a041778a77eae3ff [file] [log] [blame]
<html devsite="true">
<head>
<title>DialogFragment</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>DialogFragment</h1>
<p>
<pre>public class DialogFragment extends <a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></pre>
</p>
<div class="devsite-table-wrapper">
<table class="jd-inheritance-table">
<tbody>
<tr>
<td colspan="3"><a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></td>
</tr>
<tr>
<td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;↳</td>
<td colspan="2"><a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;↳</td>
<td colspan="1"><a href="/reference/androidx/fragment/app/DialogFragment.html">DialogFragment</a></td>
</tr>
</tbody>
</table>
</div>
<hr>
<p>Static library support version of the framework's android.app.DialogFragment. Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework SDK documentation for a class overview.</p>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Constants</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>static&nbsp;final int</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NORMAL()">STYLE_NORMAL</a></code></div>
<p>Style for <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setStyle(int,int)">setStyle</a></code>: a basic, normal dialog.</p>
</td>
</tr>
<tr>
<td width="40%"><code>static&nbsp;final int</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_FRAME()">STYLE_NO_FRAME</a></code></div>
<p>Style for <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setStyle(int,int)">setStyle</a></code>: don't draw any frame at all; the view hierarchy returned by <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code> is entirely responsible for drawing the dialog.</p>
</td>
</tr>
<tr>
<td width="40%"><code>static&nbsp;final int</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_INPUT()">STYLE_NO_INPUT</a></code></div>
<p>Style for <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setStyle(int,int)">setStyle</a></code>: like <code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_FRAME()">STYLE_NO_FRAME</a></code>, but also disables all input to the dialog.</p>
</td>
</tr>
<tr>
<td width="40%"><code>static&nbsp;final int</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_TITLE()">STYLE_NO_TITLE</a></code></div>
<p>Style for <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setStyle(int,int)">setStyle</a></code>: don't include a title area.</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/DialogFragment.html#DialogFragment()">DialogFragment</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/DialogFragment.html#DialogFragment(int)">DialogFragment</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 width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#dismiss()">dismiss</a>()</code></div>
<p>Dismiss the fragment and its dialog.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#dismissAllowingStateLoss()">dismissAllowingStateLoss</a>()</code></div>
<p>Version of <code><a href="/reference/androidx/fragment/app/DialogFragment.html#dismiss()">dismiss</a></code> that uses <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#commitAllowingStateLoss()">FragmentTransaction.commitAllowingStateLoss()</a></code>.</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Dialog</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#getDialog()">getDialog</a>()</code></div>
<p>Return the Dialog this fragment is currently controlling.</p>
</td>
</tr>
<tr>
<td width="40%"><code>boolean</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#getShowsDialog()">getShowsDialog</a>()</code></div>
<p>Return the current value of <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setShowsDialog(boolean)">setShowsDialog</a></code>.</p>
</td>
</tr>
<tr>
<td width="40%"><code>int</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#getTheme()">getTheme</a>()</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>boolean</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#isCancelable()">isCancelable</a>()</code></div>
<p>Return the current value of <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setCancelable(boolean)">setCancelable</a></code>.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onAttach(android.content.Context)">onAttach</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Context&nbsp;context)</code></div>
<p>Called when a fragment is first attached to its context.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onCancel(android.content.DialogInterface)">onCancel</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> DialogInterface&nbsp;dialog)</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onCreate(android.os.Bundle)">onCreate</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Bundle&nbsp;savedInstanceState)</code></div>
<p>Called to do initial creation of a fragment.</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Dialog</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onCreateDialog(android.os.Bundle)">onCreateDialog</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Bundle&nbsp;savedInstanceState)</code></div>
<p>Override to build your own custom Dialog container.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onDestroyView()">onDestroyView</a>()</code></div>
<p>Remove dialog.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onDetach()">onDetach</a>()</code></div>
<p>Called when the fragment is no longer attached to its activity.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onDismiss(android.content.DialogInterface)">onDismiss</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> DialogInterface&nbsp;dialog)</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> LayoutInflater</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onGetLayoutInflater(android.os.Bundle)">onGetLayoutInflater</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Bundle&nbsp;savedInstanceState)</code></div>
<p>Returns the LayoutInflater used to inflate Views of this Fragment.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onSaveInstanceState(android.os.Bundle)">onSaveInstanceState</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> 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 width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onStart()">onStart</a>()</code></div>
<p>Called when the Fragment is visible to the user.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onStop()">onStop</a>()</code></div>
<p>Called when the Fragment is no longer started.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#onViewStateRestored(android.os.Bundle)">onViewStateRestored</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> 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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Dialog</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#requireDialog()">requireDialog</a>()</code></div>
<p>Return the Dialog this fragment is currently controlling.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#setCancelable(boolean)">setCancelable</a>(boolean&nbsp;cancelable)</code></div>
<p>Control whether the shown Dialog is cancelable.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#setShowsDialog(boolean)">setShowsDialog</a>(boolean&nbsp;showsDialog)</code></div>
<p>Controls whether this fragment should be shown in a dialog.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#setStyle(int,int)">setStyle</a>(int&nbsp;style,&nbsp;int&nbsp;theme)</code></div>
<p>Call to customize the basic appearance and behavior of the fragment's dialog.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#show(androidx.fragment.app.FragmentManager,java.lang.String)">show</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;manager,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;tag)</code></div>
<p>Display the dialog, adding the fragment to the given FragmentManager.</p>
</td>
</tr>
<tr>
<td width="40%"><code>int</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#show(androidx.fragment.app.FragmentTransaction,java.lang.String)">show</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a>&nbsp;transaction,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;tag)</code></div>
<p>Display the dialog, adding the fragment using an existing transaction and then <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#commit()">committing</a></code> the transaction.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/DialogFragment.html#showNow(androidx.fragment.app.FragmentManager,java.lang.String)">showNow</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;manager,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;tag)</code></div>
<p>Display the dialog, immediately adding the fragment to the given FragmentManager.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive" id="inhmethods">
<thead>
<tr>
<th colspan="2"><h3>Inherited methods</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><devsite-expandable><span class="expand-control">From class <a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></span>
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td width="40%"><code>void</code></td>
<td>
<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> <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> <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> <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> String[]&nbsp;args<br>)</code></div>
<p>Print the Fragments's state into the given stream.</p>
</td>
</tr>
<tr>
<td width="40%"><code>final boolean</code></td>
<td>
<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> <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 width="40%"><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="/reference/androidx/fragment/app/FragmentActivity.html">FragmentActivity</a></code></td>
<td>
<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 width="40%"><code>boolean</code></td>
<td>
<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 width="40%"><code>boolean</code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Bundle</code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Context</code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Factory</code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td>
<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 width="40%"><code>final int</code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> LayoutInflater</code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Lifecycle</code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> LoaderManager</code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Resources</code></td>
<td>
<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 width="40%"><code>final boolean</code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> SavedStateRegistry</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getSavedStateRegistry()">getSavedStateRegistry</a>()</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td>
<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> Object[]&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 width="40%"><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td>
<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 width="40%"><code>final int</code></td>
<td>
<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>requestKey</code> if you need to support dynamic request keys.</p>
</p>
</td>
</tr>
<tr>
<td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/CharSequence.html">CharSequence</a></code></td>
<td>
<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 width="40%"><code>boolean</code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> View</code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> LifecycleOwner</code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> LiveData&lt;LifecycleOwner&gt;</code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> ViewModelStore</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#getViewModelStore()">getViewModelStore</a>()</code></div>
<p>Returns the ViewModelStore associated with this Fragment </p>
</td>
</tr>
<tr>
<td width="40%"><code>final int</code></td>
<td>
<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 width="40%"><code>static @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td>
<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> Context&nbsp;context,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <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 width="40%"><code>static @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td>
<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> Context&nbsp;context,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <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> 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 width="40%"><code>final boolean</code></td>
<td>
<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 width="40%"><code>final boolean</code></td>
<td>
<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 width="40%"><code>final boolean</code></td>
<td>
<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 width="40%"><code>final boolean</code></td>
<td>
<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 <fragment> tag.</p>
</td>
</tr>
<tr>
<td width="40%"><code>final boolean</code></td>
<td>
<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 width="40%"><code>final boolean</code></td>
<td>
<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 width="40%"><code>final boolean</code></td>
<td>
<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 width="40%"><code>final boolean</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> 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 width="40%"><code>void</code></td>
<td>
<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> 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 width="40%"><code>void</code></td>
<td>
<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> 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 width="40%"><code>void</code></td>
<td>
<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> <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 width="40%"><code>void</code></td>
<td>
<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> Configuration&nbsp;newConfig)</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>boolean</code></td>
<td>
<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> MenuItem&nbsp;item)</code></div>
<p>This hook is called whenever an item in a context menu is selected.</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Animation</code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Animator</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> ContextMenu&nbsp;menu,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> View&nbsp;v,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> ContextMenuInfo&nbsp;menuInfo<br>)</code></div>
<p>Called when a context menu for the <code>view</code> is about to be shown.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<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> Menu&nbsp;menu,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> MenuInflater&nbsp;inflater)</code></div>
<p>Initialize the contents of the Fragment host's standard options menu.</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> View</code></td>
<td>
<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> LayoutInflater&nbsp;inflater,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> ViewGroup&nbsp;container,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Bundle&nbsp;savedInstanceState<br>)</code></div>
<p>Called to have the fragment instantiate its user interface view.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> Activity&nbsp;activity,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> AttributeSet&nbsp;attrs,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> 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 width="40%"><code>void</code></td>
<td>
<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> Context&nbsp;context,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> AttributeSet&nbsp;attrs,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> 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 width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onLowMemory()">onLowMemory</a>()</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>boolean</code></td>
<td>
<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> MenuItem&nbsp;item)</code></div>
<p>This hook is called whenever an item in your options menu is selected.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<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> 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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> Menu&nbsp;menu)</code></div>
<p>Prepare the Fragment host's standard options menu to be displayed.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> String[]&nbsp;permissions,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> int[]&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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> View&nbsp;view,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> 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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>final void</code></td>
<td>
<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> <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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> ActivityResultLauncher&lt;I&gt;</code></td>
<td>
<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> ActivityResultContract&lt;I, O&gt;&nbsp;contract,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> 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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> ActivityResultLauncher&lt;I&gt;</code></td>
<td>
<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> ActivityResultContract&lt;I, O&gt;&nbsp;contract,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> ActivityResultRegistry&nbsp;registry,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> ActivityResultCallback&lt;O&gt;&nbsp;callback<br>)</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<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> 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 width="40%"><code>final void</code></td>
<td>
<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> String[]&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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentActivity.html">FragmentActivity</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Bundle</code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Context</code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/Fragment.html">Fragment</a></code></td>
<td>
<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 width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> View</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> Bundle&nbsp;args)</code></div>
<p>Supply the construction arguments for this fragment.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<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> 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 width="40%"><code>void</code></td>
<td>
<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> <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 width="40%"><code>void</code></td>
<td>
<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> 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 width="40%"><code>void</code></td>
<td>
<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> <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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> <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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> <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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> <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 width="40%"><code>void</code></td>
<td>
<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> <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 width="40%"><code>void</code></td>
<td>
<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> <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 width="40%"><code>void</code></td>
<td>
<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> <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>
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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>boolean</code></td>
<td>
<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> <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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> Bundle&nbsp;options)</code></div>
<p>Call Activity#startActivity(Intent, Bundle) from the fragment's containing Activity.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>void</code></td>
<td>
<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> 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 width="40%"><code>void</code></td>
<td>
<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> 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> 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 width="40%"><code>void</code></td>
<td>
<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 width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#toString()">toString</a>()</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<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> View&nbsp;view)</code></div>
<p>Prevents a context menu to be shown for the given view.</p>
</td>
</tr>
</tbody>
</table>
</div>
</devsite-expandable> </td>
</tr>
</tbody>
</table>
</div>
<h2>Constants</h2>
<div><a name="getSTYLE_NORMAL()"></a><a name="setSTYLE_NORMAL()"></a><a name="getSTYLE_NORMAL--"></a><a name="setSTYLE_NORMAL--"></a>
<h3 class="api-name" id="STYLE_NORMAL()">STYLE_NORMAL</h3>
<pre class="api-signature no-pretty-print">public&nbsp;static&nbsp;final&nbsp;int&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NORMAL()">STYLE_NORMAL</a></pre>
<p>Style for <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setStyle(int,int)">setStyle</a></code>: a basic, normal dialog.</p>
</div>
<div><a name="getSTYLE_NO_FRAME()"></a><a name="setSTYLE_NO_FRAME()"></a><a name="getSTYLE_NO_FRAME--"></a><a name="setSTYLE_NO_FRAME--"></a>
<h3 class="api-name" id="STYLE_NO_FRAME()">STYLE_NO_FRAME</h3>
<pre class="api-signature no-pretty-print">public&nbsp;static&nbsp;final&nbsp;int&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_FRAME()">STYLE_NO_FRAME</a></pre>
<p>Style for <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setStyle(int,int)">setStyle</a></code>: don't draw any frame at all; the view hierarchy returned by <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code> is entirely responsible for drawing the dialog.</p>
</div>
<div><a name="getSTYLE_NO_INPUT()"></a><a name="setSTYLE_NO_INPUT()"></a><a name="getSTYLE_NO_INPUT--"></a><a name="setSTYLE_NO_INPUT--"></a>
<h3 class="api-name" id="STYLE_NO_INPUT()">STYLE_NO_INPUT</h3>
<pre class="api-signature no-pretty-print">public&nbsp;static&nbsp;final&nbsp;int&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_INPUT()">STYLE_NO_INPUT</a></pre>
<p>Style for <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setStyle(int,int)">setStyle</a></code>: like <code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_FRAME()">STYLE_NO_FRAME</a></code>, but also disables all input to the dialog. The user can not touch it, and its window will not receive input focus.</p>
</div>
<div><a name="getSTYLE_NO_TITLE()"></a><a name="setSTYLE_NO_TITLE()"></a><a name="getSTYLE_NO_TITLE--"></a><a name="setSTYLE_NO_TITLE--"></a>
<h3 class="api-name" id="STYLE_NO_TITLE()">STYLE_NO_TITLE</h3>
<pre class="api-signature no-pretty-print">public&nbsp;static&nbsp;final&nbsp;int&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_TITLE()">STYLE_NO_TITLE</a></pre>
<p>Style for <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setStyle(int,int)">setStyle</a></code>: don't include a title area.</p>
</div>
<h2>Public constructors</h2>
<div><a name="DialogFragment--"></a><a name="dialogfragment"></a>
<h3 class="api-name" id="DialogFragment()">DialogFragment</h3>
<pre class="api-signature no-pretty-print">public&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#DialogFragment()">DialogFragment</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/DialogFragment.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.</p>
</div>
<div><a name="DialogFragment-int-"></a><a name="dialogfragment"></a>
<h3 class="api-name" id="DialogFragment(int)">DialogFragment</h3>
<pre class="api-signature no-pretty-print">public&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#DialogFragment(int)">DialogFragment</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 MyDialogFragment extends DialogFragment {
public MyDialogFragment() {
super(R.layout.dialog_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 width="40%"><code><a href="/reference/androidx/fragment/app/DialogFragment.html#DialogFragment()">DialogFragment</a></code></td>
<td></td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<h2>Public methods</h2>
<div><a name="dismiss--"></a><a name="dismiss"></a>
<h3 class="api-name" id="dismiss()">dismiss</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#dismiss()">dismiss</a>()</pre>
<p>Dismiss the fragment and its dialog. If the fragment was added to the back stack, all back stack state up to and including this entry will be popped. Otherwise, a new transaction will be committed to remove the fragment.</p>
</div>
<div><a name="dismissAllowingStateLoss--"></a><a name="dismissallowingstateloss"></a>
<h3 class="api-name" id="dismissAllowingStateLoss()">dismissAllowingStateLoss</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#dismissAllowingStateLoss()">dismissAllowingStateLoss</a>()</pre>
<p>Version of <code><a href="/reference/androidx/fragment/app/DialogFragment.html#dismiss()">dismiss</a></code> that uses <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#commitAllowingStateLoss()">FragmentTransaction.commitAllowingStateLoss()</a></code>. See linked documentation for further details.</p>
</div>
<div><a name="getDialog--"></a><a name="getdialog"></a>
<h3 class="api-name" id="getDialog()">getDialog</h3>
<pre class="api-signature no-pretty-print">public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Dialog&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#getDialog()">getDialog</a>()</pre>
<p>Return the Dialog this fragment is currently controlling.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">See also</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code><a href="/reference/androidx/fragment/app/DialogFragment.html#requireDialog()">requireDialog</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getShowsDialog--"></a><a name="getshowsdialog"></a>
<h3 class="api-name" id="getShowsDialog()">getShowsDialog</h3>
<pre class="api-signature no-pretty-print">public&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#getShowsDialog()">getShowsDialog</a>()</pre>
<p>Return the current value of <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setShowsDialog(boolean)">setShowsDialog</a></code>.</p>
</div>
<div><a name="getTheme--"></a><a name="gettheme"></a>
<h3 class="api-name" id="getTheme()">getTheme</h3>
<pre class="api-signature no-pretty-print">public&nbsp;int&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#getTheme()">getTheme</a>()</pre>
</div>
<div><a name="isCancelable--"></a><a name="iscancelable"></a>
<h3 class="api-name" id="isCancelable()">isCancelable</h3>
<pre class="api-signature no-pretty-print">public&nbsp;boolean&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#isCancelable()">isCancelable</a>()</pre>
<p>Return the current value of <code><a href="/reference/androidx/fragment/app/DialogFragment.html#setCancelable(boolean)">setCancelable</a></code>.</p>
</div>
<div><a name="onAttach-android.content.Context-"></a><a name="onattach"></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/DialogFragment.html#onAttach(android.content.Context)">onAttach</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> 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="onCancel-android.content.DialogInterface-"></a><a name="oncancel"></a>
<h3 class="api-name" id="onCancel(android.content.DialogInterface)">onCancel</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#onCancel(android.content.DialogInterface)">onCancel</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> DialogInterface&nbsp;dialog)</pre>
</div>
<div><a name="onCreate-android.os.Bundle-"></a><a name="oncreate"></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/DialogFragment.html#onCreate(android.os.Bundle)">onCreate</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> 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 width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Bundle&nbsp;savedInstanceState</code></td>
<td>
<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="onCreateDialog-android.os.Bundle-"></a><a name="oncreatedialog"></a>
<h3 class="api-name" id="onCreateDialog(android.os.Bundle)">onCreateDialog</h3>
<pre class="api-signature no-pretty-print">public&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Dialog&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#onCreateDialog(android.os.Bundle)">onCreateDialog</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Bundle&nbsp;savedInstanceState)</pre>
<p>Override to build your own custom Dialog container. This is typically used to show an AlertDialog instead of a generic Dialog; when doing so, <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code> does not need to be implemented since the AlertDialog takes care of its own content. </p>
<p>This method will be called after <code><a href="/reference/androidx/fragment/app/DialogFragment.html#onCreate(android.os.Bundle)">onCreate</a></code> and immediately before <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code>. The default implementation simply instantiates and returns a Dialog class. </p>
<p><em>Note: DialogFragment own the Dialog.setOnCancelListener and Dialog.setOnDismissListener callbacks. You must not set them yourself.</em> To find out about these events, override <code><a href="/reference/androidx/fragment/app/DialogFragment.html#onCancel(android.content.DialogInterface)">onCancel</a></code> and <code><a href="/reference/androidx/fragment/app/DialogFragment.html#onDismiss(android.content.DialogInterface)">onDismiss</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Bundle&nbsp;savedInstanceState</code></td>
<td>
<p>The last saved instance state of the Fragment, or null if this is a freshly created Fragment.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Dialog</code></td>
<td>
<p>Return a new Dialog instance to be displayed by the Fragment.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="onDestroyView--"></a><a name="ondestroyview"></a>
<h3 class="api-name" id="onDestroyView()">onDestroyView</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#onDestroyView()">onDestroyView</a>()</pre>
<p>Remove dialog.</p>
</div>
<div><a name="onDetach--"></a><a name="ondetach"></a>
<h3 class="api-name" id="onDetach()">onDetach</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#onDetach()">onDetach</a>()</pre>
<p>Called when the fragment is no longer attached to its activity. This is called after <code><a href="/reference/androidx/fragment/app/Fragment.html#onDestroy()">onDestroy</a></code>.</p>
</div>
<div><a name="onDismiss-android.content.DialogInterface-"></a><a name="ondismiss"></a>
<h3 class="api-name" id="onDismiss(android.content.DialogInterface)">onDismiss</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#onDismiss(android.content.DialogInterface)">onDismiss</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> DialogInterface&nbsp;dialog)</pre>
</div>
<div><a name="onGetLayoutInflater-android.os.Bundle-"></a><a name="ongetlayoutinflater"></a>
<h3 class="api-name" id="onGetLayoutInflater(android.os.Bundle)">onGetLayoutInflater</h3>
<pre class="api-signature no-pretty-print">public&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> LayoutInflater&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#onGetLayoutInflater(android.os.Bundle)">onGetLayoutInflater</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Bundle&nbsp;savedInstanceState)</pre>
<p>Returns the LayoutInflater used to inflate Views of this Fragment. The default implementation will throw an exception if the Fragment is not attached. </p>
<p> If this is called from within <code><a href="/reference/androidx/fragment/app/DialogFragment.html#onCreateDialog(android.os.Bundle)">onCreateDialog</a></code>, the layout inflater from <code><a href="/reference/androidx/fragment/app/Fragment.html#onGetLayoutInflater(android.os.Bundle)">Fragment#onGetLayoutInflater(Bundle)</a></code>, without the dialog theme, will be returned.</p>
</div>
<div><a name="onSaveInstanceState-android.os.Bundle-"></a><a name="onsaveinstancestate"></a>
<h3 class="api-name" id="onSaveInstanceState(android.os.Bundle)">onSaveInstanceState</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#onSaveInstanceState(android.os.Bundle)">onSaveInstanceState</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Bundle&nbsp;outState)</pre>
<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. If a new instance of the fragment later needs to be created, the data you place in the Bundle here will be available in the Bundle given to <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreate(android.os.Bundle)">onCreate</a></code>, <code><a href="/reference/androidx/fragment/app/Fragment.html#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</a></code>, and <code><a href="/reference/androidx/fragment/app/Fragment.html#onViewCreated(android.view.View,android.os.Bundle)">onViewCreated</a></code>. </p>
<p>This corresponds to Activity.onSaveInstanceState(Bundle) and most of the discussion there applies here as well. Note however: <em>this method may be called at any time before <code><a href="/reference/androidx/fragment/app/Fragment.html#onDestroy()">onDestroy</a></code></em>. There are many situations where a fragment may be mostly torn down (such as when placed on the back stack with no UI showing), but its state will not be saved until its owning activity actually needs to save its state.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Bundle&nbsp;outState</code></td>
<td>
<p>Bundle in which to place your saved state.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="onStart--"></a><a name="onstart"></a>
<h3 class="api-name" id="onStart()">onStart</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#onStart()">onStart</a>()</pre>
<p>Called when the Fragment is visible to the user. This is generally tied to Activity.onStart of the containing Activity's lifecycle.</p>
</div>
<div><a name="onStop--"></a><a name="onstop"></a>
<h3 class="api-name" id="onStop()">onStop</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#onStop()">onStop</a>()</pre>
<p>Called when the Fragment is no longer started. This is generally tied to Activity.onStop of the containing Activity's lifecycle.</p>
</div>
<div><a name="onViewStateRestored-android.os.Bundle-"></a><a name="onviewstaterestored"></a>
<h3 class="api-name" id="onViewStateRestored(android.os.Bundle)">onViewStateRestored</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#onViewStateRestored(android.os.Bundle)">onViewStateRestored</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Bundle&nbsp;savedInstanceState)</pre>
<p>Called when all saved state has been restored into the view hierarchy of the fragment. This can be used to do initialization based on saved state that you are letting the view hierarchy track itself, such as whether check box widgets are currently checked. This is called after <code><a href="/reference/androidx/fragment/app/Fragment.html#onViewCreated(android.view.View,android.os.Bundle)">onViewCreated</a></code> and before <code><a href="/reference/androidx/fragment/app/Fragment.html#onStart()">onStart</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> Bundle&nbsp;savedInstanceState</code></td>
<td>
<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="requireDialog--"></a><a name="requiredialog"></a>
<h3 class="api-name" id="requireDialog()">requireDialog</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Dialog&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#requireDialog()">requireDialog</a>()</pre>
<p>Return the Dialog this fragment is currently controlling.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Throws</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>java.lang.IllegalStateException</code></td>
<td>
<p>if the Dialog has not yet been created (before <code><a href="/reference/androidx/fragment/app/DialogFragment.html#onCreateDialog(android.os.Bundle)">onCreateDialog</a></code>) or has been destroyed (after <code><a href="/reference/androidx/fragment/app/DialogFragment.html#onDestroyView()">onDestroyView</a></code>.</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 width="40%"><code><a href="/reference/androidx/fragment/app/DialogFragment.html#getDialog()">getDialog</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setCancelable-boolean-"></a><a name="setcancelable"></a>
<h3 class="api-name" id="setCancelable(boolean)">setCancelable</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#setCancelable(boolean)">setCancelable</a>(boolean&nbsp;cancelable)</pre>
<p>Control whether the shown Dialog is cancelable. Use this instead of directly calling Dialog.setCancelable(boolean), because DialogFragment needs to change its behavior based on this.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>boolean&nbsp;cancelable</code></td>
<td>
<p>If true, the dialog is cancelable. The default is true.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setShowsDialog-boolean-"></a><a name="setshowsdialog"></a>
<h3 class="api-name" id="setShowsDialog(boolean)">setShowsDialog</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#setShowsDialog(boolean)">setShowsDialog</a>(boolean&nbsp;showsDialog)</pre>
<p>Controls whether this fragment should be shown in a dialog. If not set, no Dialog will be created and the fragment's view hierarchy will thus not be added to it. This allows you to instead use it as a normal fragment (embedded inside of its activity). </p>
<p>This is normally set for you based on whether the fragment is associated with a container view ID passed to <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#add(int,androidx.fragment.app.Fragment)">FragmentTransaction.add(int, Fragment)</a></code>. If the fragment was added with a container, setShowsDialog will be initialized to false; otherwise, it will be true. </p>
<p>If calling this manually, it should be called in <code><a href="/reference/androidx/fragment/app/DialogFragment.html#onCreate(android.os.Bundle)">onCreate</a></code> as calling it any later will have no effect.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>boolean&nbsp;showsDialog</code></td>
<td>
<p>If true, the fragment will be displayed in a Dialog. If false, no Dialog will be created and the fragment's view hierarchy left undisturbed.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setStyle(int, int)"></a><a name="setStyle-int-int-"></a><a name="setstyle"></a>
<h3 class="api-name" id="setStyle(int,int)">setStyle</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#setStyle(int,int)">setStyle</a>(int&nbsp;style,&nbsp;int&nbsp;theme)</pre>
<p>Call to customize the basic appearance and behavior of the fragment's dialog. This can be used for some common dialog behaviors, taking care of selecting flags, theme, and other options for you. The same effect can be achieve by manually setting Dialog and Window attributes yourself. Calling this after the fragment's Dialog is created will have no effect.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>int&nbsp;style</code></td>
<td>
<p>Selects a standard style: may be <code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NORMAL()">STYLE_NORMAL</a></code>, <code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_TITLE()">STYLE_NO_TITLE</a></code>, <code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_FRAME()">STYLE_NO_FRAME</a></code>, or <code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_INPUT()">STYLE_NO_INPUT</a></code>. Value is <code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NORMAL()">STYLE_NORMAL</a></code>, <code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_TITLE()">STYLE_NO_TITLE</a></code>, <code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_FRAME()">STYLE_NO_FRAME</a></code>, or <code><a href="/reference/androidx/fragment/app/DialogFragment.html#STYLE_NO_INPUT()">STYLE_NO_INPUT</a></code></p>
</td>
</tr>
<tr>
<td width="40%"><code>int&nbsp;theme</code></td>
<td>
<p>Optional custom theme. If 0, an appropriate theme (based on the style) will be selected for you.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="show(androidx.fragment.app.FragmentManager, java.lang.String)"></a><a name="show-androidx.fragment.app.FragmentManager-java.lang.String-"></a><a name="show"></a>
<h3 class="api-name" id="show(androidx.fragment.app.FragmentManager,java.lang.String)">show</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#show(androidx.fragment.app.FragmentManager,java.lang.String)">show</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;manager,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;tag)</pre>
<p>Display the dialog, adding the fragment to the given FragmentManager. This is a convenience for explicitly creating a transaction, adding the fragment to it with the given tag, and <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#commit()">committing</a></code> it. This does <em>not</em> add the transaction to the fragment back stack. When the fragment is dismissed, a new transaction will be executed to remove it from the activity.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;manager</code></td>
<td>
<p>The FragmentManager this fragment will be added to.</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;tag</code></td>
<td>
<p>The tag for this fragment, as per <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#add(androidx.fragment.app.Fragment,java.lang.String)">FragmentTransaction.add</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="show(androidx.fragment.app.FragmentTransaction, java.lang.String)"></a><a name="show-androidx.fragment.app.FragmentTransaction-java.lang.String-"></a><a name="show"></a>
<h3 class="api-name" id="show(androidx.fragment.app.FragmentTransaction,java.lang.String)">show</h3>
<pre class="api-signature no-pretty-print">public&nbsp;int&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#show(androidx.fragment.app.FragmentTransaction,java.lang.String)">show</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a>&nbsp;transaction,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;tag)</pre>
<p>Display the dialog, adding the fragment using an existing transaction and then <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#commit()">committing</a></code> the transaction.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentTransaction.html">FragmentTransaction</a>&nbsp;transaction</code></td>
<td>
<p>An existing transaction in which to add the fragment.</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;tag</code></td>
<td>
<p>The tag for this fragment, as per <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#add(androidx.fragment.app.Fragment,java.lang.String)">FragmentTransaction.add</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>int</code></td>
<td>
<p>Returns the identifier of the committed transaction, as per <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#commit()">FragmentTransaction.commit()</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="showNow(androidx.fragment.app.FragmentManager, java.lang.String)"></a><a name="showNow-androidx.fragment.app.FragmentManager-java.lang.String-"></a><a name="shownow"></a>
<h3 class="api-name" id="showNow(androidx.fragment.app.FragmentManager,java.lang.String)">showNow</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/DialogFragment.html#showNow(androidx.fragment.app.FragmentManager,java.lang.String)">showNow</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;manager,&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;tag)</pre>
<p>Display the dialog, immediately adding the fragment to the given FragmentManager. This is a convenience for explicitly creating a transaction, adding the fragment to it with the given tag, and calling <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#commitNow()">FragmentTransaction#commitNow()</a></code>. This does <em>not</em> add the transaction to the fragment back stack. When the fragment is dismissed, a new transaction will be executed to remove it from the activity.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/fragment/app/FragmentManager.html">FragmentManager</a>&nbsp;manager</code></td>
<td>
<p>The FragmentManager this fragment will be added to.</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a>&nbsp;tag</code></td>
<td>
<p>The tag for this fragment, as per <code><a href="/reference/androidx/fragment/app/FragmentTransaction.html#add(androidx.fragment.app.Fragment,java.lang.String)">FragmentTransaction.add</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>