2

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.

Talha
  • 699
  • 2
  • 12
  • 33

1 Answers1

2

According to this post from Simon Hain, you can't:

you cannot access contacts from the sim card afaik. contacts from the addressbook can be accessed with the PIM API, check http://www.blackberry.com/developers/docs/6.0.0api/net/rim/blackberry/api/pdap/BlackBerryContactList.html

That answer was circa OS 6.0, so perhaps something that I'm not aware of got added in OS 7 (?)

Nate
  • 31,017
  • 13
  • 83
  • 207