java me - How to add mobile number to blackberry contact editor in programatically from my blackberry application? -
i developing 1 application in have contact details ,when click contact number ask option call or sms or add phone contact. implemented call , sms, when trying implement add number ,name ,email in phone contact getting struggle. below code used add contact
try { contactlist contacts = null; try { contacts = (contactlist) pim.getinstance().openpimlist(pim.contact_list, pim.read_write); } catch (pimexception e) { // error occurred return; } contact contact = contacts.createcontact(); string[] name = new string[ contacts.stringarraysize( contact.name) ]; name[contact.name_given] = "kate"; name[contact.name_family] = "turner"; contact.addstringarray(contact.name, contact.attr_none,name); contact.addstring(contact.email, contact.attr_none, emailaddressto); contact.addstring(contact.tel,contact.attr_none,"6776787"//this voice call number. addressbookarguments entry = new addressbookarguments(addressbookarguments.arg_new, contact); invoke.invokeapplication(invoke.app_type_addressbook, entry); } catch (throwable t) { } }
this above code work fine when trying add mobile number this
contact.addstring(contact.attr_mobile,contact.attr_none,"mobile number");
am getting exception illegal argument exception, don't know how add mobile number here,can me solve this?
you can this,
if (contacts.issupportedfield(contact.tel)) { contact.addstring(contact.tel, contact.attr_mobile, "1234567890"); }
see ibm developerworks article more info:
develop mobile apps personal information management
Comments
Post a Comment