2

当我更新 android native 联系人时,我得到了异常:

java.lang.UnsupportedOperationException: Your selection contains data that can be deleted by ContactsProviderinternals only.
    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:168)
    at android.database.DatabaseUtils.readExceptionWithOperationApplicationExceptionFromParcel(DatabaseUtils.java:159)
    at android.content.ContentProviderProxy.applyBatch(ContentProviderNative.java:456)
    at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:120)
    at android.content.ContentResolver.applyBatch(ContentResolver.java:767)
    at 

请帮我。谢谢,

4

1 回答 1

1

确保您首先添加了权限android.permission.READ_CONTACTSandroid.permission.WRITE_CONTACTS然后您应该发布一些代码,因为不知道您如何更新它们。但是你应该像这样做

ContentValues data = new ContentValues();
data.put(ContactsContract.Contacts.DISPLAY_NAME,<data>);
data.put(ContactsContract.CommonDataKinds.Phone.NUMBER,<data>);
getContentResolver().update(workUri, data, null, null);
于 2012-06-18T08:18:06.237 回答