即使某些联系人有电话号码,以下Java方法也无法检索它们。电子邮件地址也是如此。
public String displayOne(String contactId) throws IOException, ServiceException {
String output = "";
contactId = contactId.replaceAll("base", "full");
ContactEntry contact = service.getEntry(new URL(contactId),ContactEntry.class);
Name name = contact.getName();
FullName fullName = name.getFullName();
output += "Contact details of <b>"+fullName.getValue()+"</b> <br/>";
java.util.List<PhoneNumber> phoneNumbers = contact.getPhoneNumbers();
for (PhoneNumber pn : phoneNumbers) {
output += pn.getPhoneNumber()+"<br/>";
}
output += "<br/><br/>";
java.util.List<Email> emails = contact.getEmailAddresses();
for(Email email : emails) {
output += email.getAddress()+"<br/>";
}
return output;
}
有什么想法吗?