added in version 22.1.0
belongs to Maven artifact


public class ListFragment
extends Fragment


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


Public constructors


Public methods

ListAdapter getListAdapter()

Get the ListAdapter associated with this fragment's ListView.

ListView getListView()

Get the fragment's list view widget.

long getSelectedItemId()

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

int getSelectedItemPosition()

Get the position of the currently selected list item.

View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

Provide default implementation to return a simple list view.

void onDestroyView()

Detach from list view.

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

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

void onViewCreated(View view, Bundle savedInstanceState)

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

void setEmptyText(CharSequence text)

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

void setListAdapter(ListAdapter adapter)

Provide the cursor for the list view.

void setListShown(boolean shown)

Control whether the list is being displayed.

void setListShownNoAnimation(boolean shown)

Like setListShown(boolean), 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