Code example for AlertDialog.Builder

Methods: setMultiChoiceItems

0
              + entryList.length + ", " + keyList.length + ", " + valueList.length);
    } 
 
    // Set multi selectable items and its handler. 
    dialogValueList = valueList.clone();
    builder.setMultiChoiceItems(entryList, dialogValueList, new OnMultiChoiceClickListener() {
      @Override 
      public void onClick(DialogInterface dialog, int which, boolean isChecked) {
        dialogValueList[which] = isChecked;
      } 
    }); 
  } 
 
  @Override 
  protected void onDialogClosed(boolean positiveResult) {
    super.onDialogClosed(positiveResult);
    if (positiveResult) {
      // If user tap OK, set the value. 
      setValues(dialogValueList);
    } 
  }