我的删除记录功能:
public void delete_byID(int uid){
sqLiteDatabase.delete(KK_AIRLINEBOOK, KEY_ID + "= ?", new String[] {String.valueOf(uid)});
}
还有我试图删除记录的代码:
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
// set title
alertDialogBuilder.setTitle("Cancel Booking");
// set dialog message
alertDialogBuilder.setMessage("Do You Really Want To Cancel Your Booking!")
.setCancelable(false)
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, close
// current activity
Toast.makeText(CancelCabBooking.this, "Your
Booking Is Canceled Now Thank You!!!!!",
Toast.LENGTH_LONG).show();
int uid=myPrefs.getInt("USERID", 0);
mySQLiteAdapter.delete_byID(uid);
Intent submit= new Intent(CancelCabBooking.this,Customerhome.class);
startActivity(submit);
finish();
srno.setText("");
charges.setText("");
seats.setText("");
CancelCabBooking.this.finish();
}
}
)
.setNegativeButton("No",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.cancel();
}
}
);
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}
我没有收到任何错误,但记录没有被删除。它保持原样。请帮助我,我已经提到了很多答案,但还没有完成。谢谢你