Tuesday, October 5, 2010

[android-developers] How to change the e-mail address programmatically?

Hi I'm trying to change the e-mail address info of some contacts
programmatically.

I have the following contact:
Name: John Patrick
Phone: 1234567890
ID: 15
E-mail: john@univ.edu (The type is work e-mail)

I'm using the following code to change the e-mail address
programmatically:

ContentValues contentValues = new ContentValues();
contentValues.put( People.ContactMethods.KIND, Contacts.KIND_EMAIL);
contentValues.put( People.ContactMethods.DATA, "john@company.com" );
contentValues.put( People.ContactMethods.TYPE,
People.ContactMethods.TYPE_WORK );
builder.encodedPath(People.ContactMethods.CONTENT_DIRECTORY + "/" +
"15");
Uri uri = builder.build();
getContentResolver().update( uri, contentValues, null, null );

My understanding is that the code above should run successfully.
However, when I excecute this code, the e-mail information in my
contact doesn't get updated. Any ideas what is going wrong here?

Thank you in advance,

-Ali

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate