title: back button on dialog is cancelling dialog even though I have a listener on it
body: <p>I have a dialog show and I want that when the back button is pressed to ask the user to confirm he wants to cancel the dialog before the cancellation takes effect. Here is my code:</p>
  
  <pre><code>dialog.setOnCancelListener(new OnCancelListener(){
  
              @Override
              public void onCancel(DialogInterface arg0) {
                  AlertDialog.Builder builder = new AlertDialog.Builder(dialog.getContext());
                  builder.setMessage( "Are you sure you want to cancel?")
                         .setCancelable(false)
                         .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                             public void onClick(DialogInterface diag, int id) {
                                 diag.dismiss();
                                 dialog.dismiss();
  
                             }
                         })
                         .setNegativeButton("No", new DialogInterface.OnClickListener() {
                             public void onClick(DialogInterface diag, int id) {
                                  diag.cancel();
                             }
                         });
                  AlertDialog alert = builder.create();
                  alert.show();               
              }
  
          });
          dialog.show();
  </code></pre>
  
  <p>The problem is that when back button is hit then my current dialog is cancelled then my "confirmation message" is displayed. How can I ensure the dialog is not cancelled until the user confirms that ?</p>