Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android
by Jakob Iversen, Michael Eierman
Create the Custom Adapter
A custom list item is of little use without a custom adapter. Custom adapters are always created as subclasses of another type of adapter that is the closest fit for the behavior needed. Create a new class called ContactAdapter in the com.example.mycontactlist source folder. Modify the class by adding the code in Listing 6.7.
Listing 6.7 ContactAdapter Code
//1public class ContactAdapter extends ArrayAdapter<Contact> { //2 private ArrayList<Contact> items; private Context adapterContext; //3 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access