小编Luc*_*man的帖子

如何将复选框添加到警报对话框

目前,当用户打开我的应用程序时,会AlertDialog打开询问他们是否要升级到专业版.我需要添加一个CheckBox,AlertDialog这将使应用程序不再显示AlertDialog用户打开应用程序时.

这就是我AlertDialog现在所拥有的:

AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(" MY_TEXT");
    builder.setMessage(" MY_TEXT ")
           .setCancelable(false)
           .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                   Uri uri = Uri.parse("market://details?id=MY_APP_PACKAGE");
                   Intent intent = new Intent (Intent.ACTION_VIEW, uri);
                   startActivity(intent);                          }
           })
           .setNegativeButton("No", new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
               }
           }).show();
Run Code Online (Sandbox Code Playgroud)

如果有人能告诉我如何将添加CheckBoxAlertDialog,这将使应用不再显示AlertDialog当用户打开应用程序,这将是巨大的.提前致谢!

checkbox android android-alertdialog

40
推荐指数
3
解决办法
4万
查看次数

标签 统计

android ×1

android-alertdialog ×1

checkbox ×1