Is there a way I can read a contacts number using the PIM API. I'm using the code below and it's just returning the name. I want the code to return the number only from a contact.
pim = PIM.getInstance();
ContactsList.setModel(new DefaultListModel());
try {
String[] pimListNames = pim.listPIMLists(PIM.CONTACT_LIST);
for (int i = 0; i < pimListNames.length; ++i) {
ContactList cl = (ContactList) pim.openPIMList(
PIM.CONTACT_LIST, PIM.READ_ONLY, pimListNames[i]);
Enumeration items = cl.items();
while (items.hasMoreElements()) {
Contact c = (Contact) items.nextElement();
ContactsList.addItem(c.getString(Contact.FORMATTED_NAME, 0));
}
}
} catch (PIMException ex) {
WittyClassObject.showAlert("error", ex.toString());
}
Have you tried to use
c.getString(Contact.TEL, 0) // instead of c.getString(Contact.FORMATTED_NAME, 0) ?