8.3.6. Extending Class ListFragment to Create a Fragment That Contains a ListView

When a Fragment’s primary task is to display a scrollable list of items, you can extend class ListFragment (package android.app, Section 8.6)—this is nearly identical to extending ListActivity, as you did in Chapter 4. A ListFragment uses a ListView as its default layout. In this app, rather than an ArrayAdapter, we’ll use a CursorAdapter (package android.widget) to display the results of a database query in the ListView.

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.