Troubleshooting guide

170
BlackBerry Java Development Environment Development Guide
Using the address book
Open the address book from your application
Use contacts
Task Steps
Open the address book. > From an application, invoke
Invoke.invokeApplication(APP_TYPE_ADDRESSBOOK,AddressBookArgum
ents)
.
Open a contact using PIM data. 1. Create an instance of an AddressBookArguments object, specifying as a parameter
a
Contact object.
AddressBookArguments abArg = AddressBookArguments(String arg,
Contact contact);
2. Invoke Invoke.invokeApplication(APP_TYPE_ADDRESSBOOK,
AddressBookArguments)
using the AddressBookArguments object for the
contact.
Invoke.invokeApplication(APP_TYPE_ADDRESSBOOK, abArg);
Manage exceptions. >Check for a ControlledAccessException if your application invokes a
BlackBerry® application that you do not have permission to use or access.
Task Steps
Provide access to the PIN BlackBerry® device
contacts field.
>Use the BlackBerryContact.PIN constant.
Provide access to the USER1 through USER4
BlackBerry device contacts fields.
> Use the following constants:
BlackBerryContact.USER1
BlackBerryContact.USER2
BlackBerryContact.USER3
BlackBerryContact.USER4
Define labels for the USER1 through USER4
BlackBerry device contacts fields.
Changing a label affects all contacts on the BlackBerry device.
>Invoke BlackBerryPIMList.setFieldLabel().
Open a contacts list. 1. Create a contacts list.
ContactList contactList = null;
2. Invoke PIM.openPIMList() and provide as parameters the type of list to open
(PIM.CONTACT_LIST) and the access mode with which to open the list
(READ_WRITE, READ_ONLY, or WRITE_ONLY).
try {
contactList = (ContactList)PIM.getInstance().openPIMList(
PIM.CONTACT_LIST, PIM.READ_WRITE);
} catch (PimException e) {
return;
}