Update contact detail with android 2.0 (ContactsContract)

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

Update contact detail with android 2.0 (ContactsContract)

Postby dhaiwat » Wed May 05, 2010 7:25 am

Hi,

My task that i want to do with ContactsContract API of android 2.0 to update
the details of the particular contact.

I am able to do that work with android 1.6 with old api.but facing lots of problem with android 2.0 api for contact

I use following way to update name but not get any result
Please share your finding on updating the contact
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ArrayList<ContentProviderOperation>
  2.  
  3. operations =
  4.  
  5.                                         new ArrayList<ContentProviderOperation>();
  6.  
  7.  
  8.  
  9.                                 operations.add(ContentProviderOperation.newUpdate(
  10.  
  11.                             ContactsContract.Data.CONTENT_URI).withSelection(
  12.  
  13.                             Data.CONTACT_ID + "=?", new String[]
  14.  
  15. { id }).withValue(
  16.  
  17.                             StructuredName.GIVEN_NAME, "John").withValue(
  18.  
  19.                                         StructuredName.FAMILY_NAME,
  20.  
  21. "Abraham").build());
  22.  
  23.  
  24.  
  25.                                
  26.  
  27.                                         getContentResolver().applyBatch(ContactsContract.AUTHORITY,
  28.  
  29. operations);
  30.  
  31.  
Parsed in 0.045 seconds, using GeSHi 1.0.8.4
dhaiwat
Developer
Developer
 
Posts: 28
Joined: Tue Feb 10, 2009 6:49 am

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: Google [Bot] and 3 guests