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.

void
setListShownNoAnimation(boolean shown)

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

void
setSelection(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<I>
<I, O> registerForActivityResult(
    @NonNull ActivityResultContract<I, O> contract,
    @NonNull ActivityResultCallback<O> callback
)

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

abstract @NonNull ActivityResultLauncher<I>
<I, O> registerForActivityResult(
    @NonNull ActivityResultContract<I, O> contract,
    @NonNull ActivityResultRegistry registry,
    @NonNull ActivityResultCallback<O> callback
)

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

From class ComponentCallbacks
abstract void
abstract void
From class Fragment
void
dump(
    @NonNull String prefix,
    @Nullable FileDescriptor fd,
    @NonNull PrintWriter writer,
    String[] args
)

Print the Fragments's state into the given stream.

final @Override boolean

Subclasses can not override equals().

final @Nullable FragmentActivity

Return the FragmentActivity this fragment is currently associated with.

boolean

Returns whether the the exit transition and enter transition overlap or not.

boolean