Launch the Address Book and return a contact

by Retired ‎02-16-2010 01:04 PM - edited ‎09-16-2010 02:58 PM (4,120 Views)



This article applies to the following:


  • BlackBerry® Device Software 4.0
  • BlackBerry wireless devices based on Java™


A method in the net.rim.blackberry.api.pdap.BlackBerryContactList class will allow you to launch the Address Book with a listing of all the contacts currently on the device. Selecting a contact will return that contact into your application so that you can retrieve its values.  The net.rim.blackberry.api.pdap.BlackBerryContactList class was introduced in the BlackBerry API 4.0 set.


In the sample code below, the contact list must be opened first. For this example, it is being opened in READ_WRITE mode. Then the ContactList is cast to a BlackBerryContactList to provide the functionality required.



BlackBerryContactList list = (BlackBerryContactList)PIM.getInstance().


Contact contact = list.choose

(null, BlackBerryContactList.AddressTypes.EMAIL, false);

if (contact != null)


String email = contact.getString(Contact.EMAIL, 0);

System.out.println("Name is: " + email);


The choose() accepts 3 parameters


  1. Contact used as the starting point in the address book (may be null)
  2. One of the address types defined by the BlackBerryContactList.AddressTypes interface.
  3. Boolean value to indication if the selection of addresses can be from a different service (ie. BIS, etc)

When this line is executed it returns the contact the user selected from the address book. At this point the application is able to read data from that contact.