Pin Me

Dev Guide to Creating an Android Address Book

written by: Jbeerdev•edited by: Simon Hill•updated: 6/8/2010

In this tutorial, we will create our own Address book in the Android Programming Environment, we'll do this in a simple way so we can use some of the things we have learned in previous tutorials.

  • slide 1 of 5


    The idea is to have a list of contacts, with the name and phone number, for example (but it can be whatever you want - the contact picture, the email address, etc.), when we touch a contact, a new screen will appear with full information about this contact, and with 2 options: Call him/her or send him/her an SMS.

  • slide 2 of 5


    We will need two Activities, one for the Contact list and another with the information of the contact and the buttons with the “Send SMS" and “Call" Options.

    Getting the contacts information will be done using Content providers.

    And the “Send SMS" and “Call" functionality will be implemented using Intents.

  • slide 3 of 5

    Structure and Classes

    We are going to work with two java classes.

    ContactList → This class will extend from ListActivity, this means that this activity holds a list of data, a ListView will be its screen layout. Here contact information will be displayed in a list form.

    ContactPage → This will be a normal Activity, here we will show the contact information and we will add two buttons to the “Call" and “Send" SMS functionality.

    About the resources we are going to use.


    mainlist.xml → This will be the layout we are going to use in the ContactList, it will just be a LinearLayout and a ListView.

    row.xml → This will just be a TextView. We will use this in one of the two different implementations we are going to work with.

    contact.xml → This will be a more complex page. It can be whatever we want. I mean, we can put the elements we want here, in the order or position we want. It is just to show information for the contact. Want the photo at the top? Or maybe at the left of the information? This will be your decision. One important thing, is to place two ImageButtons, one for the SMS and the other for Calling.


    We can search on the Internet, for some good icons, and use them in our ImageButtons in the contact.xml layout.


    We can add in our string.xml the static values we want. For example if in the contact page, we are going to put labels on the fields we are showing, it would be interesting to add these labels here, in string.xml instead of writing them by hand.

    Name: Jose B. Cortés

    The label “Name" can be placed in “string.xml"

  • slide 4 of 5

    Android Classes

    As I said before, we are going to use Content Providers to get the information from the Phone. From Content Providers, let's remember something.

    Cursor → This will be the class we are going to use to manage rows queried from the DB.

    Other important classes we are going to use, are Intents.

    An intent is an abstract description of an operation to be performed (ref: Google). So we are going to use them in 2 ways:

    -One of them is to open an Activity from another Activity, passing to it parameters.

    -Other way is saying to an Activity to perform an action, like “Call this number" or “Send a SMS to this person"

  • slide 5 of 5

    Want more?

    Do you have any idea about how we are going to construct it? Think about it before the next lessons!!

How to- Develop Applications on Android: Simple Applications

In this 5-articles series we will see how to create simple applications, using the tools and knowledge we have acquiredfrom others articles.
  1. How to Create a Calculator in Google Android: Part I
  2. Guide to Creating a Calculator in Android
  3. Dev Guide to Creating an Android Address Book
  4. How-to create an Address Book in the Google Android Programming Environment - ListActivity Implementation
  5. Dev Guide to Making an Android Address Book