我有对话框弹出。里面有一个按钮。当我单击按钮时,将显示确认弹出窗口(是/否)。但问题是对话框弹出关闭。当确认弹出窗口显示时,我不想关闭对话框弹出窗口。我想知道怎么做。这是我的编码..
Button deleteBtn = (Button) findViewById(R.id.deleteBtn);
deleteBtn.setOnClickListener(new OnClickListener(){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Choose delete tasks");
builder.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
showMsgDialog();
}
});
private void showMsgDialog() {
AlertDialog alertDialog = new AlertDialog.Builder(this).create();
// Setting Dialog Title
alertDialog.setTitle("deleting..");
// Setting Dialog Message
alertDialog.setMessage("Are you sure want to delete?");
alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// deleting process.
}
});
alertDialog.show();
}
谢谢。