我需要访问黑莓中的联系人列表,我编写了以下代码来执行此操作:
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) {
}
}
在 j2me 中,此代码可以访问 SIM 和手机联系人,但在黑莓中,它仅访问手机联系人。
String lists[] = pim.listPIMLists(PIM.CONTACT_LIST);
lists.length
返回 1
如何在黑莓手机中访问 SIM 卡联系人? 提前致谢。
最佳答案
根据this post from Simon Hain ,你不能:
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
这个答案大约是 OS 6.0,所以也许在 OS 7 中添加了我不知道的东西(?)
关于blackberry - 如何访问 Blackberry 中的 SIM 卡联系人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17061158/