我想显示一个带“确定”按钮的消息框。我使用了下面的代码,但是它导致了一个带参数的编译错误:
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
dlgAlert.setMessage("This is an alert with no consequence");
dlgAlert.setTitle("App Title");
dlgAlert.setPositiveButton("OK", null);
dlgAlert.setCancelable(true);
dlgAlert.create().show();
我应该如何在 Android 中显示消息框?