Code example for AlertDialog.Builder

Methods: setPositiveButton, setSingleChoiceItems

0
    updateSummary(); 
  } 
 
  @Override 
  protected void onPrepareDialogBuilder(final Builder builder) {
    builder.setSingleChoiceItems(adapter, -1, new DialogInterface.OnClickListener() {
 
      @Override 
      public void onClick(final DialogInterface dialog, final int which) {
        calendarId = adapter.getItemId(which);
        CalendarListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
        dialog.dismiss();
      } 
    }); 
    builder.setPositiveButton(null, null);
  } 
 
  @Override 
  protected void onDialogClosed(final boolean positiveResult) {
    super.onDialogClosed(positiveResult);
    String strVal = Long.toString(calendarId);