ListFragment

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

Object
   ↳ Fragment
     ↳ ListFragment

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.

Summary

Public constructors

Public methods

@Nullable ListAdapter

Get the ListAdapter associated with this fragment's ListView.

@NonNull ListView

Get the fragment's list view widget.

long

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

int

Get the position of the currently selected list item.

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

Provide default implementation to return a simple list view.

@Override void

Detach from list view.

void
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.

void

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

void

Provide the cursor for the list view.

void
setListShown(boolean shown)

Control whether the list is being displayed.