title: setOnShowListener () not working in DialogPreference
body: <p>I am implementing a <code>DialogPreference</code> in a class. I want that when the positive button of the dialog is clicked, the dialog should not dismiss. I am using the logic from <a href="https://stackoverflow.com/a/7636468/2486731">this answer.</a></p>
  
  <p>Insided the class I use:</p>
  
  <pre><code>protected void onPrepareDialogBuilder(Builder builder) {
      super.onPrepareDialogBuilder(builder);
  
      final AlertDialog d = builder.create();
  
      d.setOnShowListener(new DialogInterface.OnShowListener() {
  
          @Override
          public void onShow(DialogInterface dialog) {
  
              Toast.makeText(mContext, "inside", Toast.LENGTH_SHORT).show();
              Button b = d.getButton(DialogInterface.BUTTON_POSITIVE);
              b.setOnClickListener(new View.OnClickListener() {
  
                  @Override
                  public void onClick(View view) {
                      // TODO Do something
  
                      // Dismiss once everything is OK.
                      d.dismiss();
                  }
              });
          }
      });
  }
  </code></pre>
  
  <p>But when I open the dialog, I do not see the <code>Toast</code>,and the dialog closes. So how is my implementation of <a href="https://stackoverflow.com/a/7636468/2486731">that answer</a> wrong?</p>