mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-04-15 02:22:09 +02:00
fix contact deleting
This commit is contained in:
parent
18bbe6667d
commit
eee3a19e96
@ -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…
x
Reference in New Issue
Block a user