BlackBerryContactList contList;try {contList = BlackBerryContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST,PIM.READ_ONLY);Enumeration er = contList.items();while (er.hasMoreElements()){BlackBerryContact c = (BlackBerryContact)er.nextElement();if ((contList.isSupportedField(Contact.NAME)) && (c.countValues(Contact.NAME) > 0)){String[] name = c.getStringArray(Contact.NAME, 0);String firstName = name[Contact.NAME_GIVEN];String lastName = name[Contact.NAME_FAMILY];//here is the code snippet to iterate all phone nrs of a contactif ((contList.isSupportedField(Contact.TEL)) && (c.countValues(Contact.TEL) > 0)) {int numValues = 0;try {numValues = c.countValues(Contact.TEL);} catch (Exception localException) {}for (int i = 0; i < numValues; ++i) {if (c.getAttributes(Contact.TEL, i) == Contact.ATTR_MOBILE)mobilenumber = c.getString(Contact.TEL, i);}}Dialog.alert(firstName+" "+lastName +" "+mobilenumber);}}} catch (PIMException e) {// TODO Auto-generated catch blocke.printStackTrace();}
Monday, April 16, 2012
Get contacts from Blackberry Contacts
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment