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.

@NonNull long

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

@NonNull 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 @NonNull void

Detach from list view.

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

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

@Override @NonNull 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.

@NonNull void

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

@NonNull void

Provide the cursor for the list view.

@NonNull void
setListShown(@NonNull boolean shown)

Control whether the list is being displayed.

@NonNull void

Like setListShown, but no animation is used when transitioning from the previous state.

@NonNull void
setSelection(@NonNull int position)

Set the currently selected list item to the specified position with the adapter's data

Inherited methods

From class ActivityResultCaller
abstract @NonNull ActivityResultLauncher<@NonNull I>

Register a request to start an activity for result, designated by the given contract.

abstract @NonNull ActivityResultLauncher<@NonNull I>

Register a request to start an activity for result, designated by the given contract.

From class ComponentCallbacks
From class Fragment
@NonNull void