add a new number to an existing contact on Android 2.2 -


i trying add new numbers (or emails or websites) existing contact, code not work well. code followings:

int rowid = cursor1.getint(cursor1                 .getcolumnindex(contactscontract.rawcontacts._id)); contentvalues contentvalues = new contentvalues(); contentvalues.put(contactscontract.data.raw_contact_id, rowid); contentvalues.put(contactscontract.data.mimetype,         contactscontract.commondatakinds.phone.content_item_type); contentvalues.put(contactscontract.commondatakinds.phone.number,         "45435345"); contentvalues.put(contactscontract.commondatakinds.phone.type,         phone.type_home);  ops.add(contentprovideroperation         .newinsert(contactscontract.data.content_uri)         .withvalues(contentvalues).build()); 

when codes run ,there no errors,and there no changes.i depressed it.any save me!!!

maybe need these 2 permissions:

<uses-permission android:name="android.permission.read_contacts" /> <uses-permission android:name="android.permission.write_contacts" /> 

perhaps need use contentresolver instead of contentvalues.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -