当我运行我的应用程序时,对话框没有弹出,我错过了什么吗?
这是我的代码:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("This is a test!")
.setCancelable(false)
.setPositiveButton("I Agree", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MainScreen.this.finish();
}
})
.setNegativeButton("I Disagree", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
//Set your icon here
.setTitle("Alert!")
.setIcon(R.drawable.ic_launcher);
AlertDialog alert = builder.create();
感谢所有帮助。