【发布时间】:2014-05-02 14:12:51
【问题描述】:
我正在编写一个简单的游戏,现在,我希望我的应用程序在倒计时结束时显示一个对话框。我尝试了该代码(见下文),但它不起作用:
protected void alertbox()
{
new AlertDialog.Builder(this)
.setMessage("You've scored " + score + " points!")
.setTitle("Congatulations!")
.setCancelable(false)
.setNeutralButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton){}
ButtonActivity.this.finish();
})
.show();
}
【问题讨论】:
-
点击“确定”时致电
finish()? -
“但它不起作用” - 这是什么意思?它崩溃了吗?什么都没发生?等?,发布堆栈跟踪
标签: android android-activity dialog