【问题标题】:not able to read J2ME PIM contact details无法读取 J2ME PIM 联系方式
【发布时间】:2011-12-26 17:16:55
【问题描述】:

我想使用诺基亚 S60 sdk 中的 PIM api 读取联系人详细信息,例如名字、姓氏、手机号码、电话、传真、地址、同步和 UID 详细信息。

但是,我只得到了 Contact.TEL 和 Contact.EMAIL 值,没有得到其他值,不过,我可以在模拟器联系人详细信息中看到名字、姓氏等其他字段。

我已经配置了所有需要的权限。

ContactList addressbook = (ContactList) (PIM.getInstance().openPIMList(
PIM.CONTACT_LIST, PIM.READ_ONLY));
Contact contact = null;

Enumeration items = addressbook.items();
while (items.hasMoreElements()) {
String name = "";
String telephone = "";
String mobile = "";
String email = "";
String InternetTelephone = "";
String Company = "";
String JobTitle = "";
String Synchronisation = "";
String UID = "";
String LastModified = "";
String contactRow = "";
System.out.println("\n *** NEW ITEM  ***");
contact = (Contact) (items.nextElement());
System.out.println(" * contact : " + contact.toString());
try {      
name = contact.getString(Contact.FORMATTED_NAME, 0);
System.out.println("Name = " + name);
} catch (Exception ex) {
 System.out.println(" Name  error "+ ex.getMessage());
}

try {       
mobile = contact.getString(Contact.ATTR_MOBILE, 0);
System.out.println("Name = " + name);
} catch (Exception ex) {
 System.out.println(" Name  error "+ ex.getMessage());
}


try
{   telephone = contact.getString(Contact.TEL, 0);
System.out.println("Telephone = " + contact.getString(115, 0)); //field 115: Telephone
} catch (Exception ex) {
System.out.println(" Telephone  error "+ ex.getMessage());
}

try
{      
email = contact.getString(Contact.EMAIL, 0);
System.out.println("E-mail = " + contact.getString(103, 0)); 
} catch (Exception ex) {
 System.out.println(" E-mail  error "+ ex.getMessage());
}

try
{ 
UID = contact.getString(Contact.UID, 0);
System.out.println(" UID " + UID ); 
} catch (Exception ex) {
System.out.println(" UID  error "+ ex.getMessage());
}

try
{
LastModified = contact.getString(114, 0);
System.out.println(" Last modified " + contact.getString(114, 0)); 
} catch (Exception ex) {
System.out.println(" Last modified error "+ ex.getMessage());
}

期待您的宝贵建议。

提前致谢。

【问题讨论】:

  • 查看我对其他帖子 here 的回答。设备上支持的Contact 属性因设备而异,因此您需要使用PIMList.getSupportedFields() 查询它并确定其中可用的Contact 属性。通过这样做,您还可以验证目标设备是否支持提到的 OP Contact 属性。模拟器上的 PIM 支持与设备完全不同,因此建议检查目标设备上的 PIM 实现。
  • 您好,感谢您的回复,我已经阅读了您的帖子。问题是,我得到了大约 8 到 9 个文件作为受支持的文件,但没有从中获得任何价值,如果我尝试获取文件的值、异常电子邮件、名字、姓氏和电话以及移动设备,其他像 UID、Synchronizastion、语音呼叫和其他字段这样的字段没有得到任何字段,尽管它们出现在受支持的字段标签中。

标签: java-me contact pim


【解决方案1】:

【讨论】:

  • 感谢您的回复,这将对其他人有所帮助。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-01
  • 1970-01-01
相关资源
最近更新 更多