其他代码正在运行,但未显示警报对话框。
代码:
AlertDialog.Builder confirm = new AlertDialog.Builder(MainActivity.this);
confirm.setTitle("Do you confirm this order?");
confirm.setMessage(order);
confirm.setCancelable(true);
confirm.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
orderId ++;
orderConfirmed = order;
order = "";
}
});
答案 0 :(得分:0)
您需要在确认后添加.show()
。
答案 1 :(得分:0)
一个重要的电话丢失了,去做-confirm.show()
答案 2 :(得分:0)
AlertDialog.Builder confirm = new AlertDialog.Builder(MainActivity.this);
confirm.setTitle("Do you confirm this order?");
confirm.setMessage(order);
confirm.setCancelable(true);
confirm.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
orderId ++;
orderConfirmed = order;
order = "";
}
});
AlertDialog.show();
希望这对您有帮助