33
4: Using the address book
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;
}
Create a contact.
To add a contact to the database, you must commit it. See “Save a contact” on page 173 for
more information about committing contact data.
>
Invoke
createContact()
on a contact list.
Contact contact = contactList.createContact();
Task
Steps
Summary of Contents for JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE
Page 4: ......
Page 7: ......
Page 10: ...10 BlackBerry Device Applications Integration Guide...
Page 12: ...12 BlackBerry Device Applications Integration Guide...
Page 50: ...50 BlackBerry Device Applications Integration Guide...
Page 56: ...56 BlackBerry Device Applications Integration Guide...
Page 65: ......
Page 66: ...2008 Research In Motion Limited Published in Canada...