PHP Code:
try {
BlackBerryContactList ct_lst = (BlackBerryContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY);
PIMItem item = null;
item = ct_lst.choose();
parseFields(item);
} catch (PIMException ex) {
ex.printStackTrace();
}
}
private void parseFields(Object obj) {
Stringxxx91;xxx93; names = null;
String FName = null, LName = null;
String EMail = null;
String mobile = null;
String workPh = null;
intxxx91;xxx93; fields = null;
Contact objCont = null;
/////////////////////////////////
if (obj instanceof Contact) {
objCont = (Contact) obj;
fields = objCont.getFields();
for (int y = 0; y < objCont.countValues(Contact.TEL); y++) {
if (objCont.getAttributes(objCont.TEL, y) == Contact.ATTR_MOBILE) {
mobile = objCont.getString(Contact.TEL, y);
} else if (objCont.getAttributes(objCont.TEL, y) == Contact.ATTR_WORK) {
workPh = objCont.getString(Contact.TEL, y);
}
}
// ////////////////////////////////////////////////////////////
int index = 0;
while (index < fields.length) {
switch (fieldsxxx91;indexxxx93;) {
case Contact.EMAIL:
EMail = objCont.getString(fieldsxxx91;indexxxx93;, 0);
break;
case Contact.NAME:
names = objCont.getStringArray(fieldsxxx91;indexxxx93;, 0);
FName = namesxxx91;Contact.NAME_GIVENxxx93;;
LName = namesxxx91;Contact.NAME_FAMILYxxx93;;
if (LName == null) {
LName = null;
}
LogPrinter.logSpecificEvent("Contact returned:" + FName + " " + LName);
break;
}
index++;
}
}
}