我遇到了该方法的语法错误
setPositiveButton(String, new DialogInterface.OnClickListener(){}) : is undefined for the type AlertDialog
如何解决?
AlertDialog alertDialog = null;
alertDialog = new AlertDialog.Builder(MainActivity.this).create();
alertDialog.setTitle("error msg");
alertDialog.setMessage("You should register before");
alertDialog.setCancelable(true);
alertDialog.setPositiveButton("Ok",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//dismiss the dialog
}
});
alertDialog.show();