title: How to set progress dialog to not cancelable when being managed as a fragment?
body: <p>I'm using a <code>ProgressDialog</code> managed as a <code>Fragment</code>. Even if I set the <code>ProgressDialog</code> to be non-cancelable, the BACK button will still operate to remove that <code>Fragment</code> from the stack. My inner class look like this: </p>
  
  <pre><code>public static class ProgressDialogFragment extends DialogFragment {
  
      private DialogStyle dialogStyle;
  
      public static ProgressDialogFragment newInstance(String title, String message) {
          ProgressDialogFragment fragment = new ProgressDialogFragment();
          Bundle args = new Bundle();
          args.putString("title", title);
          args.putString("message", message);
          fragment.setArguments(args);
  
          return fragment;
      }
  
      public void setDialogStyle(DialogStyle dialogStyle) {
          this.dialogStyle = dialogStyle;
      }
  
  
      @Override
      public ProgressDialog onCreateDialog(Bundle savedInstanceState) {
          String title = getArguments().getString("title");
          String message = getArguments().getString("message");
  
          ProgressDialog progressDialog = new ProgressDialog(getActivity());
          progressDialog.setTitle(title);
          progressDialog.setMessage(message);
  
          if(dialogStyle!=null) {
              switch (dialogStyle) {
                  case CANCELABLE:
                      progressDialog.setCancelable(true);
                      break;
                  case NON_CANCELABLE:
                      progressDialog.setCancelable(false);
                      break;
  
              }
          } else {
              progressDialog.setCancelable(false);
          }
  
          progressDialog.show();
  
          return progressDialog;
      }
  }
  </code></pre>
  
  <p>And then the method I expose is: </p>
  
  <pre><code>public void showProgressDialog(String title, String message, DialogStyle dialogStyle) {
              Fragment prev = fragmentManager.findFragmentByTag("progress dialog");
              if(prev!=null) {
                  ft.remove(prev);
              }
              ft.addToBackStack(null);
  
              DialogFragment newFragment = ProgressDialogFragment.newInstance(title, message);
              ((ProgressDialogFragment)newFragment).setDialogStyle(dialogStyle);
              newFragment.show(fragmentManager, "progress dialog");
          }
  </code></pre>
  
  <p>So the obvious confusion here is that the BACK button removes the <code>ProgressDialog</code> because it's being managed as a <code>Fragment</code>. So how can I make it so that the <code>Dialog</code> is not cancelable?</p>
  
  <p>Seems strange to try something like: </p>
  
  <pre><code>@Override
      public void onBackPressed() {
          if(fragmentManager.fragmentManager.findFragmentByTag("progress dialog")!=null) {
  
          }
      }
  </code></pre>