I need to access contact list in blackberry, I writ following code to do that:
private void readContacts() {
try {
PIM pim;
pim = PIM.getInstance();
String lists[] = pim.listPIMLists(PIM.CONTACT_LIST);
for (int i = 0; i < lists.length ; i++) {
clist = (ContactList) pim.openPIMList(PIM.CONTACT_LIST,
PIM.READ_ONLY, lists[i]);
Enumeration cenum = clist.items();
while (cenum.hasMoreElements()) {
Contact c = (Contact) cenum.nextElement();
ContactDTO contact = new ContactDTO();
parseContactInfo(c, contact);
contacts.addElement(contact);
}
clist.close();
}
} catch (Exception e) {
}
}
In j2me this code access both sim and phone contacts but in blackberry it is accessing only phone contacts.
String lists[] = pim.listPIMLists(PIM.CONTACT_LIST);
lists.length
return 1
How I can access sim contacts in blackberry?? Thanks in advance.
According to this post from Simon Hain, you can't:
That answer was circa OS 6.0, so perhaps something that I'm not aware of got added in OS 7 (?)