Skip to content

Good article that provides breakdown of PIM

There is a new article that describes jsr 75 PIM package implementation.

Here is also some sample code that opens up the contacts loops through the list and extracts Name and phoneNumber from each record.

if (PhoneConstants.JSR75_INCLUDED) {
PIM pimInstance = PIM.getInstance();
ContactList list = (ContactList) pimInstance.openPIMList( PIM.CONTACT_LIST, PIM.READ_WRITE);
Enumeration contacts = list.items();
while (contacts.hasMoreElements()) {
Contact contact = (Contact) contacts.nextElement();
String name = "";
if (list.isSupportedField(Contact.TEL)) {
for (int i = 0, size = contact.countValues(Contact.TEL); i < size; i++) {
String telStr = contact.getString(Contact.TEL, i);
int attr = contact.getAttributes(Contact.TEL, i);
String phoneType = null;
if ((attr & Contact.ATTR_SMS) != 0) {
phoneType = "sms";
} else if ((attr & Contact.ATTR_MOBILE) != 0) {
phoneType = "mobile";
} else if ((attr & Contact.ATTR_HOME) != 0) {
phoneType = "home";
}
}
}
}
}

// TODO: find out how to post code snippets in WordPress

technorati tags: j2me jsr75 PIM

Post a Comment

You must be logged in to post a comment.