Friday, April 29, 2011

[android-developers] Re: Update Contacts

Hi Ali

thanks for this blog. I already found it earlier :)

My code now looks like
String select = ContactsContract.Data.RAW_CONTACT_ID + "=? AND " +
ContactsContract.Data.MIMETYPE + " = ?";
String[] args = new String[]
{String.valueOf(_nContactID),ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE};

Cursor crPeople =
_context.getContentResolver().query(ContactsContract.Data.CONTENT_URI,
null, select, args, null);



ops.add(ContentProviderOperation.newUpdate(ContactsContract.Contacts.CONTENT_URI)
.withSelection(select, args)
.withValue(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME,
_sFamilyName)
.withValue(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME,
_sGivenName)
.withValue(ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME,
_sMiddleName)
.build());

The crPeople is just for a test und the person was found.
But when I call the update it get an error no such column mimetype...

Any ideas?

On 28 Apr., 21:21, Ali Chousein <ali.chous...@gmail.com> wrote:
> Hhhmmm, I'm not exactly sure what is wrong with your syntax. I have
> another blog which gives a full fledged example, in which "newUpdate"
> is used. I'm sure that, the example with "newUpdate" in that blog
> works. Maybe you may try to follow the syntax there. The address is:http://email-addresses-in-android-contacts.blogspot.com/

--
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

No comments:

Post a Comment