Multiple contact lists support

Support for multiple contact lists is available in BlackBerry® Java® Development Environment 5.0 or later. Each contact list has a system-assigned contact list name and a UID that you can use to retrieve the list. You can change the contact list name by using the BlackBerry® Desktop Manager to change the name of the service that is associated with the contact list name. You cannot change the UID.

When deciding how you want to open a contact list, you should consider persistence on the BlackBerry device. If your application requires the contact list name to persist across OS updates, use the UID to open the contact list. If your application requires the contact list name to persist only across BlackBerry device restarts, you can use the contact list name. Because a contact list name can change, you can register a listener for name change events by invoking BlackBerryPIM.addListChangeListener(ListChangeListener listener).

You can retrieve the names of the contact lists that are installed on a BlackBerry device by invoking PIM.listPIMLists(int pimListType) and passing in PIM.CONTACT_LIST as pimListType. The String array that is returned provides the system-assigned names for the contact lists on the device. The contact list name that is at index 0 of the returned String array is the default contact list. You can retrieve the UID of a contact list on a BlackBerry device by invoking BlackBerryPIMList.getPIMListUID().

You can open a contact list by its name by invoking PIM.openPIMList(int pimListType, int mode, String name). You can open a contact list by its UID by invoking BlackBerryPIM.openPIMList(int pimListType, int mode, long uid). You can open a list that combines multiple contact lists on a device by invoking one of the BlackBerryPIM.openUnifiedPIMList() methods.

Previous topic: Contact list

Was this information helpful? Send us your comments.