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

Get Android™ 6 for Programmers: An App-Driven Approach, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.