我的代码在下面并且在从onCreate()调用时运行良好我既没有错误也没有stracktrace。它只是不显示。AlertDialog.Builderbuilder=newAlertDialog.Builder(this);builder.setMessage("Areyousureyouwanttoexit?").setCancelable(false).setPositiveButton("Yes",newDialogInterface.OnClickListener(){publicvoidonClick(DialogInterfacedialog,intid){finish()
androidMessagebox因为finish调用不显示,如何让这个函数等待ok然后关闭publicvoidmsbox(Stringstr,Stringstr2){AlertDialog.BuilderdlgAlert=newAlertDialog.Builder(this);dlgAlert.setMessage(str2);dlgAlert.setTitle(str);dlgAlert.setPositiveButton("OK",null);dlgAlert.setCancelable(true);dlgAlert.create().show();finish();}应该是这
我想显示一个带有确定按钮的消息框。我使用了以下代码,但它会导致带有参数的编译错误:AlertDialog.BuilderdlgAlert=newAlertDialog.Builder(this);dlgAlert.setMessage("Thisisanalertwithnoconsequence");dlgAlert.setTitle("AppTitle");dlgAlert.setPositiveButton("OK",null);dlgAlert.setCancelable(true);dlgAlert.create().show();我应该如何在Android中显示消息框?
我想显示一个带有确定按钮的消息框。我使用了以下代码,但它会导致带有参数的编译错误:AlertDialog.BuilderdlgAlert=newAlertDialog.Builder(this);dlgAlert.setMessage("Thisisanalertwithnoconsequence");dlgAlert.setTitle("AppTitle");dlgAlert.setPositiveButton("OK",null);dlgAlert.setCancelable(true);dlgAlert.create().show();我应该如何在Android中显示消息框?