9.10 ContactsFragment Class

Class ContactsFragment displays the contact list in a RecyclerView and provides a FloatingActionButton that the user can touch to add a new contact.

9.10.1 Superclass and Implemented Interface

Figure 9.31 lists ContactsFragment’s package statement and import statements and the beginning of its class definition. The ContactsFragment uses a LoaderManager and a Loader to query the AddressBookContentProvider and receive a Cursor that the ContactsAdapter (Section 9.11) uses to supply data to the RecyclerView. ContactsFragment implements interface LoaderManager.LoaderCallbacks<Cursor> (line 23) so that it can respond to method calls from the LoaderManager to create the Loader and process the results returned by the AddressBookContentProvider ...

Get Android How to Program, 3/e 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.