code: private void initializeSelectionListener() {
          ChoiceMode choiceMode = adapter.getChoiceMode();
  
          if (choiceMode instanceof MultipleChoiceMode) {
              adapter.setOnItemClickListener(
                      new OnMultiChoiceClickListenerWrapper(multiChoiceListener, getDialog(), 0));
          } else if (choiceMode instanceof SingleChoiceMode) {
              adapter.setOnItemClickListener(
                      new OnItemClickListenerWrapper(singleChoiceListener, getDialog(), 0));
          } else {
              adapter.setOnItemClickListener(
                      new OnItemClickListenerWrapper(singleChoiceListener, getDialog(),
                              DialogInterface.BUTTON_POSITIVE));
          }
      }
docs: Initializes the listener, which should be notified, when the selection of a list item of the
  dialog has been changed.