所以我有一个带有该方法的数据库:
public boolean deleteContact(long rowId) {
return db.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
}
我对如何使用它有一个大致的了解,但它只是不删除项目。我不知道如何找出项目所在的行。这是其中包含数据库的列表视图,带有 on select 事件:
private void Items() {
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(ItemsList.this);
dlgAlert.setTitle("Something Here");
dlgAlert.setMessage("What would you like to do?");
dlgAlert.setPositiveButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
dlgAlert.setNegativeButton("Delete",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//This is where it should be finding what row the item is in and deleting it...
}
});
dlgAlert.setCancelable(true);
dlgAlert.create().show();
}