fix contact deleting
This commit is contained in:
parent
18bbe6667d
commit
eee3a19e96
1 changed files with 6 additions and 2 deletions
|
|
@ -453,9 +453,13 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
||||||
val operations = ArrayList<ContentProviderOperation>()
|
val operations = ArrayList<ContentProviderOperation>()
|
||||||
val selection = "${ContactsContract.Data.RAW_CONTACT_ID} = ?"
|
val selection = "${ContactsContract.Data.RAW_CONTACT_ID} = ?"
|
||||||
contacts.forEach {
|
contacts.forEach {
|
||||||
val selectionArgs = arrayOf(it.id.toString())
|
ContentProviderOperation.newDelete(ContactsContract.Data.CONTENT_URI).apply {
|
||||||
operations.add(ContentProviderOperation.newDelete(ContactsContract.RawContacts.CONTENT_URI).withSelection(selection, selectionArgs).build())
|
val selectionArgs = arrayOf(it.id.toString())
|
||||||
|
withSelection(selection, selectionArgs)
|
||||||
|
operations.add(this.build())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.contentResolver.applyBatch(ContactsContract.AUTHORITY, operations)
|
activity.contentResolver.applyBatch(ContactsContract.AUTHORITY, operations)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
activity.showErrorToast(e)
|
activity.showErrorToast(e)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue