public class ListFragment extends Fragment implements LifecycleOwner, ViewModelStoreOwner, HasDefaultViewModelProviderFactory, LifecycleOwner, SavedStateRegistryOwner, ActivityResultCaller

   ↳ Fragment
     ↳ ListFragment

Static library support version of the framework's 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.


Public constructors

Public methods

@Nullable ListAdapter

Get the ListAdapter associated with this fragment's ListView.

@NonNull ListView

Get the fragment's list view widget.


Get the cursor row ID of the currently selected list item.


Get the position of the currently selected list item.

@Override @Nullable View
    @NonNull LayoutInflater inflater,
    @Nullable ViewGroup container,
    @Nullable Bundle savedInstanceState

Provide default implementation to return a simple list view.

@Override void

Detach from list view.

onListItemClick(@NonNull ListView l, @NonNull View v, int position, long id)

This method will be called when an item in the list is selected.

@Override void
onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)

Attach to list view once the view hierarchy has been created.

final @NonNull ListAdapter

Get the ListAdapter associated with this fragment's ListView.


The default content for a ListFragment has a TextView that can be shown when the list is empty.


Provide the cursor for the list view.

setListShown(boolean shown)

Control whether the list is being displayed.