小编Nik*_*our的帖子

我无法在Android中使用setMultiChoiceItems的对话框中显示列表

我有一个方法返回CharSequence []并且不为空(用日志检查)但不显示在对话框中.我是否必须初始化boolean []数组; 我没有看到任何错误,所以也许有一些我想念的东西.我的代码是:

dbManager.open();
final CharSequence[] usrCats = dbManager.getUserCreatedCategories();

dbManager.close();
final boolean[] selections = new boolean[usrCats.length];

   alert = b.setTitle(R.string.remove_category)
            .setMessage(R.string.delete_categories_msg)
            .setMultiChoiceItems(usrCats, selections, new DialogInterface.OnMultiChoiceClickListener(){
             public void onClick(DialogInterface dialog, int which, boolean isChecked){
            }
        })

            .setPositiveButton("Create", new DialogInterface.OnClickListener(){
             public void onClick(DialogInterface dialog, int which){
            }       
    }).create();
  }
Run Code Online (Sandbox Code Playgroud)

android dialog

6
推荐指数
1
解决办法
1376
查看次数

标签 统计

android ×1

dialog ×1