blob: e73575dda4c9fa7a3e7ada316eb3cba7e93610ec [file] [log] [blame]
<html devsite="true">
<head>
<title>ListFragment</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>ListFragment</h1>
<p>
<pre>public class ListFragment 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/ListFragment.html">ListFragment</a></td>
</tr>
</tbody>
</table>
</div>
<hr>
<p>Static library support version of the framework's android.app.ListFragment. 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>Public constructors</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#ListFragment()">ListFragment</a>()</code></div>
</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>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> ListAdapter</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#getListAdapter()">getListAdapter</a>()</code></div>
<p>Get the ListAdapter associated with this fragment's ListView.</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> ListView</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#getListView()">getListView</a>()</code></div>
<p>Get the fragment's list view widget.</p>
</td>
</tr>
<tr>
<td width="40%"><code>long</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#getSelectedItemId()">getSelectedItemId</a>()</code></div>
<p>Get the cursor row ID of the currently selected list item.</p>
</td>
</tr>
<tr>
<td width="40%"><code>int</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#getSelectedItemPosition()">getSelectedItemPosition</a>()</code></div>
<p>Get the position of the currently selected list item.</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/ListFragment.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>Provide default implementation to return a simple list view.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#onDestroyView()">onDestroyView</a>()</code></div>
<p>Detach from list view.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#onListItemClick(android.widget.ListView,android.view.View,int,long)">onListItemClick</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> ListView&nbsp;l,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> View&nbsp;v,&nbsp;int&nbsp;position,&nbsp;long&nbsp;id)</code></div>
<p>This method will be called when an item in the list is selected.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.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>Attach to list view once the view hierarchy has been created.</p>
</td>
</tr>
<tr>
<td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> ListAdapter</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#requireListAdapter()">requireListAdapter</a>()</code></div>
<p>Get the ListAdapter associated with this fragment's ListView.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#setEmptyText(java.lang.CharSequence)">setEmptyText</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/CharSequence.html">CharSequence</a>&nbsp;text)</code></div>
<p>The default content for a ListFragment has a TextView that can be shown when the list is empty.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#setListAdapter(android.widget.ListAdapter)">setListAdapter</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> ListAdapter&nbsp;adapter)</code></div>
<p>Provide the cursor for the list view.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#setListShown(boolean)">setListShown</a>(boolean&nbsp;shown)</code></div>
<p>Control whether the list is being displayed.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#setListShownNoAnimation(boolean)">setListShownNoAnimation</a>(boolean&nbsp;shown)</code></div>
<p>Like <code><a href="/reference/androidx/fragment/app/ListFragment.html#setListShown(boolean)">setListShown</a></code>, but no animation is used when transitioning from the previous state.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/ListFragment.html#setSelection(int)">setSelection</a>(int&nbsp;position)</code></div>
<p>Set the currently selected list item to the specified position with the adapter's data</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><a href="/reference/androidx/fragment/app/Fragment.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><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>void</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onCreate(android.os.Bundle)">onCreate</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> 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/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>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#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>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> LayoutInflater</code></td>
<td>
<div><code><a href="/reference/androidx/fragment/app/Fragment.html#onGetLayoutInflater(android.os.Bundle)">onGetLayoutInflater</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> 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/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#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/Fragment.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/Fragment.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/Fragment.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>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>Public constructors</h2>
<div><a name="ListFragment--"></a><a name="listfragment"></a>
<h3 class="api-name" id="ListFragment()">ListFragment</h3>
<pre class="api-signature no-pretty-print">public&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#ListFragment()">ListFragment</a>()</pre>
</div>
<h2>Public methods</h2>
<div><a name="getListAdapter--"></a><a name="getlistadapter"></a>
<h3 class="api-name" id="getListAdapter()">getListAdapter</h3>
<pre class="api-signature no-pretty-print">public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> ListAdapter&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#getListAdapter()">getListAdapter</a>()</pre>
<p>Get the ListAdapter associated with this fragment's ListView.</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/ListFragment.html#requireListAdapter()">requireListAdapter</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getListView--"></a><a name="getlistview"></a>
<h3 class="api-name" id="getListView()">getListView</h3>
<pre class="api-signature no-pretty-print">public&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> ListView&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#getListView()">getListView</a>()</pre>
<p>Get the fragment's list view widget.</p>
</div>
<div><a name="getSelectedItemId--"></a><a name="getselecteditemid"></a>
<h3 class="api-name" id="getSelectedItemId()">getSelectedItemId</h3>
<pre class="api-signature no-pretty-print">public&nbsp;long&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#getSelectedItemId()">getSelectedItemId</a>()</pre>
<p>Get the cursor row ID of the currently selected list item.</p>
</div>
<div><a name="getSelectedItemPosition--"></a><a name="getselecteditemposition"></a>
<h3 class="api-name" id="getSelectedItemPosition()">getSelectedItemPosition</h3>
<pre class="api-signature no-pretty-print">public&nbsp;int&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#getSelectedItemPosition()">getSelectedItemPosition</a>()</pre>
<p>Get the position of the currently selected list item.</p>
</div>
<div><a name="onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)"></a><a name="onCreateView-android.view.LayoutInflater-android.view.ViewGroup-android.os.Bundle-"></a><a name="oncreateview"></a>
<h3 class="api-name" id="onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)">onCreateView</h3>
<pre class="api-signature no-pretty-print">public&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> View&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.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>)</pre>
<p>Provide default implementation to return a simple list view. Subclasses can override to replace with their own layout. If doing so, the returned view hierarchy <em>must</em> have a ListView whose id is android.R.id.list and can optionally have a sibling view id android.R.id.empty that is to be shown when the list is empty. </p>
<p>If you are overriding this method with your own custom content, consider including the standard layout list_content in your layout file, so that you continue to retain all of the standard behavior of ListFragment. In particular, this is currently the only way to have the built-in indeterminant progress state be shown.</p>
</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/ListFragment.html#onDestroyView()">onDestroyView</a>()</pre>
<p>Detach from list view.</p>
</div>
<div><a name="onListItemClick(android.widget.ListView, android.view.View, int, long)"></a><a name="onListItemClick-android.widget.ListView-android.view.View-int-long-"></a><a name="onlistitemclick"></a>
<h3 class="api-name" id="onListItemClick(android.widget.ListView,android.view.View,int,long)">onListItemClick</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#onListItemClick(android.widget.ListView,android.view.View,int,long)">onListItemClick</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> ListView&nbsp;l,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> View&nbsp;v,&nbsp;int&nbsp;position,&nbsp;long&nbsp;id)</pre>
<p>This method will be called when an item in the list is selected. Subclasses should override. Subclasses can call getListView().getItemAtPosition(position) if they need to access the data associated with the selected item.</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> ListView&nbsp;l</code></td>
<td>
<p>The ListView where the click happened</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> View&nbsp;v</code></td>
<td>
<p>The view that was clicked within the ListView</p>
</td>
</tr>
<tr>
<td width="40%"><code>int&nbsp;position</code></td>
<td>
<p>The position of the view in the list</p>
</td>
</tr>
<tr>
<td width="40%"><code>long&nbsp;id</code></td>
<td>
<p>The row id of the item that was clicked</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="onViewCreated(android.view.View, android.os.Bundle)"></a><a name="onViewCreated-android.view.View-android.os.Bundle-"></a><a name="onviewcreated"></a>
<h3 class="api-name" id="onViewCreated(android.view.View,android.os.Bundle)">onViewCreated</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.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)</pre>
<p>Attach to list view once the view hierarchy has been created.</p>
</div>
<div><a name="requireListAdapter--"></a><a name="requirelistadapter"></a>
<h3 class="api-name" id="requireListAdapter()">requireListAdapter</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> ListAdapter&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#requireListAdapter()">requireListAdapter</a>()</pre>
<p>Get the ListAdapter associated with this fragment's ListView.</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 no ListAdapter has been set.</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/ListFragment.html#getListAdapter()">getListAdapter</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setEmptyText-java.lang.CharSequence-"></a><a name="setemptytext"></a>
<h3 class="api-name" id="setEmptyText(java.lang.CharSequence)">setEmptyText</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#setEmptyText(java.lang.CharSequence)">setEmptyText</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> <a href="https://developer.android.com/reference/java/lang/CharSequence.html">CharSequence</a>&nbsp;text)</pre>
<p>The default content for a ListFragment has a TextView that can be shown when the list is empty. If you would like to have it shown, call this method to supply the text it should use.</p>
</div>
<div><a name="setListAdapter-android.widget.ListAdapter-"></a><a name="setlistadapter"></a>
<h3 class="api-name" id="setListAdapter(android.widget.ListAdapter)">setListAdapter</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#setListAdapter(android.widget.ListAdapter)">setListAdapter</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a> ListAdapter&nbsp;adapter)</pre>
<p>Provide the cursor for the list view.</p>
</div>
<div><a name="setListShown-boolean-"></a><a name="setlistshown"></a>
<h3 class="api-name" id="setListShown(boolean)">setListShown</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#setListShown(boolean)">setListShown</a>(boolean&nbsp;shown)</pre>
<p>Control whether the list is being displayed. You can make it not displayed if you are waiting for the initial data to show in it. During this time an indeterminant progress indicator will be shown instead. </p>
<p>Applications do not normally need to use this themselves. The default behavior of ListFragment is to start with the list not being shown, only showing it once an adapter is given with <code><a href="/reference/androidx/fragment/app/ListFragment.html#setListAdapter(android.widget.ListAdapter)">setListAdapter</a></code>. If the list at that point had not been shown, when it does get shown it will be do without the user ever seeing the hidden 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>boolean&nbsp;shown</code></td>
<td>
<p>If true, the list view is shown; if false, the progress indicator. The initial value is true.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setListShownNoAnimation-boolean-"></a><a name="setlistshownnoanimation"></a>
<h3 class="api-name" id="setListShownNoAnimation(boolean)">setListShownNoAnimation</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#setListShownNoAnimation(boolean)">setListShownNoAnimation</a>(boolean&nbsp;shown)</pre>
<p>Like <code><a href="/reference/androidx/fragment/app/ListFragment.html#setListShown(boolean)">setListShown</a></code>, but no animation is used when transitioning from the previous state.</p>
</div>
<div><a name="setSelection-int-"></a><a name="setselection"></a>
<h3 class="api-name" id="setSelection(int)">setSelection</h3>
<pre class="api-signature no-pretty-print">public&nbsp;void&nbsp;<a href="/reference/androidx/fragment/app/ListFragment.html#setSelection(int)">setSelection</a>(int&nbsp;position)</pre>
<p>Set the currently selected list item to the specified position with the adapter's data</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;position</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>