O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required