ContactListFragmentListener Interface and ContactListFragment Instance Variables

Figure 8.25 begins class ContactListFragment’s declaration. Lines 23–30 declare the nested interface ContactListFragmentListener, which contains the callback methods that MainActivity implements to be notified when the user selects a contact (line 26) and when the user touches the menu item to add a new contact (line 29). Line 32 declares instance variable listener which will refer to the object (MainActivity) that implements the interface. Instance variable contactListView (line 34) will refer to the ContactListFragment’s builtin ListView, so we can interact with it programmatically. Instance variable contactAdapter will refer to the CursorAdapter that populates ...

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.