On Apr 19, 2:41 pm, Timo Prill <timo.pr...@googlemail.com> wrote: > hi all, > > i got a problemupdatingacontact'sdetails. > i use the following code to update thecontactname: > "operations" is a ArrayList of ContentProviderOperation. > > operations.add(ContentProviderOperation.newUpdate( > ContactsContract.Data.CONTENT_URI) > .withSelection(Data._ID + "=?", new String[]{id}) > > .withValue(Data.MIMETYPE,StructuredName.CONTENT_ITEM_TYPE) > .withValue(StructuredName.GIVEN_NAME, firstName) > .withValue(StructuredName.FAMILY_NAME, lastName) > .build()); > > contentResolver.applyBatch(ContactsContract.AUTHORITY, operations); > > but after this query, thecontactname is not updated.. (at least the > name did not change in the phone's addressbook) > i cant figure out why...what am i doing wrong? must be a simple thing i > am missing.. > > thanks in advance > timo > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en
Hi, I have used your code snippet for updating contact details with API 2.0. But using that, display name is updated successfully, but it deletes all the other information like phone number and email. Can you tell me why it happens?..or I am missing something... Here Data used is "android.provider.ContactsContract.Data". The same code I have used is as below: ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(); operations.add(ContentProviderOperation.newUpdate( ContactsContract.Data.CONTENT_URI).withSelection( Data.CONTACT_ID + "=?", new String[] { id }).withValue( StructuredName.GIVEN_NAME, "John").withValue( StructuredName.FAMILY_NAME, "Abraham").build()); try { getContentResolver().applyBatch(ContactsContract.AUTHORITY, operations); } catch (RemoteException e) { System.out.println("Exception : " + e.getMessage()); e.printStackTrace(); } catch (OperationApplicationException e) { System.out.println("Exception : " + e.getMessage()); e.printStackTrace(); } Please share your thoughts. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en