When using contentResolver.delete(uri, null, null) then a success determination can be made by looking at the return value of the number of rows.
However, deleting a contact using ContentProviderOperation and applyBatch returns ContentProviderResult[]
How can you determine if the delete operation was successful or not from the ContentProviderResult object?
Did uninstall succeed with ContentProviderOperation?
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); ops.add(ContentProviderOperation.newDelete(Data.CONTENT_URI) .withSelection(Data._ID + "=?", new String[]{String.valueOf(dataId)}) .build()); ContentProviderResult[] results = getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops); if (results != null && results[0] != null) {
source share