我有此代码可以删除联系人组
public void delete(Activity act,String[] args) {
try {
int b=act.getContentResolver().delete(ContactsContract.Groups.CONTENT_URI,"_ID=?", args);
Toast.makeText(act, "Deleted",Toast.LENGTH_SHORT).show();
//notify registered observers that a row was updated
act.getContentResolver().notifyChange(ContactsContract.Groups.CONTENT_URI, null);
} catch (Exception e) {
Log.v(TAG, e.getMessage(), e);
Toast.makeText(act, TAG + " Delete Failed",Toast.LENGTH_LONG).show();
}
}
我称该方法为
private void processDelete(long rowId) {
String[] args = { String.valueOf(rowId) };
objItem.delete(this, args);
cur.requery();
}
我有
<uses-permission android:name="android.permission.WRITE_CONTACTS"></uses-permission>
身份证通过了。
b 值返回 1,但没有执行删除,在活动重启时我仍然看到列表中的记录。我做错了什么?