当我更新android原生联系人时,我得到了例外:
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
请帮帮我。 谢谢,
答案 0 :(得分:1)
请确保您首先添加了权限android.permission.READ_CONTACTS
和android.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);