【发布时间】:2011-10-05 06:08:47
【问题描述】:
我正在循环遍历 Contact.TEL 字段的所有属性以检索名称和数据,以便可以显示如下内容:
HOME: +2034953213
工作: +2033923959
手机: +20179083008
我已经使用 PIM api 成功检索了值(+2034953213、+2033923959、+20179083008),但我不知道如何检测与我检索到的值对应的属性:(HOME、WORK 或移动...等)?
我如何检测到 +2034953213 是 'HOME' 或 'WORK' 或 'MOBILE' ?
其他检索到的值也有同样的问题?
这是我的代码:
ContactList contactList = (ContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
Enumeration contactListItems = contactList.items();
while (contactListItems.hasMoreElements()) {
Contact contact = (Contact)contactListItems.nextElement();
int telephonesCount = contact.countValues(Contact.TEL);
for(int i=0; i< telephonesCount; ++i) {
String number = contact.getString(Contact.TEL, i);
// I want here to know what is the current attribute that i retrieved its value ?
// I mean its value not its index (either HOME, WORK or MOBILE ...etc)
}
}
【问题讨论】:
标签: blackberry java-me contacts contact-list pim