Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

i can't display the list in a dialog with setMultiChoiceItems in Android

Tags:

android

dialog

i have a method that returns the CharSequence[] and is not empty(checked with log) but is not displayed in the dialog. do i have to initalize the boolean[] array; i dont see any mistake so maybe there is something i miss. my code is:

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();
  }
like image 351
Nik Tsekour Avatar asked Feb 02 '12 12:02

Nik Tsekour


1 Answers

I don't know why but setMessage and setMultiChoiceItems cannot work together. When I remove the setMessage, the list displays just fine.

like image 151
Nik Tsekour Avatar answered Nov 15 '22 07:11

Nik Tsekour