【发布时间】:2012-05-24 22:05:23
【问题描述】:
当我运行我的应用程序时,没有弹出对话框,是我遗漏了什么吗?
这是我的代码:
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();
感谢所有帮助。
【问题讨论】:
标签: android eclipse button dialog