Exercise

Write an application that adds contacts to the BlackBerry® device address book.

Objective

  • Discover how to create a contact in the handheld address book.

Setup

  1. Download the file (ZIP)
  2. In the IDE, open the rolodex.jdw workspace
  3. Open the Rolodex.java source file.

Tasks

  1. Add code to the onSave() method to complete the following tasks:
    1. define variables to store the information that the user entered in the UI
    2. verify that the user entered a first and last name
    3. open the handheld address book database
    4. create a new contact with the information that the user entered
    5. save the contact to the address book
    6. reset the UI fields to be empty
  2. Build and run your application in the simulator.
  3. In your application, create and save a contact.
  4. Open the handheld address book and verify that the contact appears.

Check Your Work

Download the completed code (ZIP)

Review

In this exercise, you discovered the following things:

  • how to access the handheld address book database
  • how to create and add a contact

Additional Labs

Go to the next exercise in “Connecting to Email, Calendar and PIM Applications on BlackBerry”, Using the Options API


Back to the Developer Lab Main Menu