title: OnCancelListener is not called in DialogFragment
body: <p>I have a simple <code>AlertDialog</code> that displays a list of some items and upon clicking one of them, the clicked item is passed back to the enclosing <code>Activity</code>. I also want to perform some default handling when the user cancels the dialog (using the <em>back button</em>) - more specifically, I want to pass an empty string to the activity in such case.</p>
  
  <p>However, if I put the dialog in a <code>DialogFragment</code> (from the <strong>compatibility package</strong>), the <code>OnCancelListener</code> <strong>is not called when I close the dialog with the back button</strong>. What am I doing wrong?</p>
  
  <pre><code>public class SelectItemDialog extends DialogFragment {
  
      public interface Callback {
          void onItemSelected(String string);
      }
  
      private static final String ARG_ITEMS = "items";
  
      private Callback callback;
  
      public static SelectItemDialog fromItems(Collection&lt;String&gt; items) {
          SelectItemDialog fragment = new SelectItemDialog();
          fragment.setArguments(newArguments(items));
          return fragment;
      }
  
      private static Bundle newArguments(Collection&lt;String&gt; items) {
          Bundle arguments = new Bundle();
          arguments.putStringArray(ARG_ITEMS, items.toArray(new String[items.size()]));
          return arguments;
      }
  
      @Override
      public void onAttach(Activity activity) {
          super.onAttach(activity);
          callback = (Callback) activity;
      }
  
      @Override
      public Dialog onCreateDialog(Bundle savedInstanceState) {
          final String[] items = getArguments().getStringArray(ARG_ITEMS);
          return new AlertDialog.Builder(getActivity())
              .setTitle(R.string.dialog_select_email_title)
              .setItems(items, new OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                      callback.onItemSelected(items[which]);
                  }
              })
              .setOnCancelListener(new OnCancelListener() {
                  @Override
                  public void onCancel(DialogInterface dialog) {
                      // this code is not executed
                      callback.onItemSelected("");
                      throw new RuntimeException("dialog cancelled");
                  }
              })
              .create();
      }
  }
  </code></pre>