有谁知道如何从电话簿中获取email2和mobile2? BlackBerryContact类没有用于email2和mobile2的常量,例如BlackBerryContact.EMAIL。

最佳答案

    if (contacts.isSupportedField(BlackBerryContact.EMAIL)) {
             try {
                 if (contact.countValues(BlackBerryContact.EMAIL) > 0)
                     email1 = contact.getString(BlackBerryContact.EMAIL, 0);
                 System.out.println("Email1 " + email1);

                 if (contact.countValues(BlackBerryContact.EMAIL) > 1)
                     email2 = contact.getString(BlackBerryContact.EMAIL, 1);
                 System.out.println("Email2 " + email2);
             } catch (Exception e) {
                 System.out.println("Exception::" + e.getMessage());
             }
         }

if (contacts.isSupportedField(BlackBerryContact.TEL)) {
                        int count = contact.countValues(BlackBerryContact.TEL);
                        for (int i = 0; i < count; i++) {
                            int attribute = contact.getAttributes(BlackBerryContact.TEL, i);
                            if(attribute == BlackBerryContact.ATTR_MOBILE){
                                String mobile = contact.getString(BlackBerryContact.TEL,i);
                                lblField1.setText(mobile);
                            }
                            if(attribute == BlackBerryContact.ATTR_HOME){
                                String home = contact.getString(BlackBerryContact.TEL, i);
                                lblField2.setText(home);
                            }
                        }

                    }

关于blackberry - 如何从电话簿联系人获取email2和mobile2,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4623433/

10-08 21:25