code: private OnClickListener createListItemListener() {
          return new OnClickListener() {
  
              @Override
              public void onClick(final DialogInterface dialog, final int which) {
                  selectedIndex = which;
                  ListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
                  dialog.dismiss();
              }
          };
      }
docs: Creates and returns a listener, which allows to persist the value a list item, which is
  clicked by the user.
  
  @return The listener, which has been created, as an instance of the type {@link
  OnClickListener}