开发者

Why does Android Contact modify have a side effect of created an (Unknown) contact entry?

I have a weird issue on an Android 2.2 device. I have an existing contact and I do a modify operation on it via:

ContentProviderOperation.Builder builder =
ContentProviderOperatio开发者_StackOverflow中文版n.newUpdate(ContactsContract.Data.CONTENT_URI)
    .withSelection(ContactsContract.Data.CONTACT_ID + "=? AND " +
    ContactsContract.Data.MIMETYPE + "=?",
    new String[]{id,
    ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE})
    .withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME,displayName)
    .withValue(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME,familyName)
    .withValue(ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME,middleName)
    .withValue(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME,givenName)
    .withValue(ContactsContract.CommonDataKinds.StructuredName.PREFIX,honorificPrefix)
   .withValue(ContactsContract.CommonDataKinds.StructuredName.SUFFIX,honorificSuffix);

mApp.getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);

The contact gets modified correctly. All of the new values show up for the Contacts name.

However, if I look in my Contacts app there is a new contact called "(Unknown)" that shows up after I do a modify. I can insert as many contacts as I want but every modify creates a new "(Unknown)" contact.

Anyone have any ideas?


There was an errant newInsert() call for the RAW_CONTACT_ID as part of the larger function which was causing the problem. Sorry for the time wasting question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜