PDA

View Full Version : how to:add data to contact and save contact to cotact list progrematically


Omri
08-04-2010, 01:19 AM
i use this code in order to save data into contact that i made with my app.
i keep getting exception but im not sure why..
anyone can help me with that??

case 3:
ButtonField buttonfield3 = (ButtonField) field;
try {
ContactList contactList = (ContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.WRITE_ONLY);
if (contactList.isSupportedField(Contact.NAME)) {
Contact contact = contactList.createContact();
String[] name = new String[ contactList.stringArraySize( Contact.NAME ) ];
name[Contact.NAME_GIVEN] = "Kate";
name[Contact.NAME_FAMILY] = "Turner";
contact.addStringArray(Contact.NAME, Contact.ATTR_NONE, new String[] {"Kate Turner"});
try{
contact.commit();
}
catch (Exception e) {

dc/dc
08-04-2010, 04:10 AM
You need to check the Developer section.