title: Show one progress dialog only at a time in android?
body: <p>I wonder android support multiple dialog? Since when I first open the dialog. I allow user to click cancel, that will open one more dialog to confirm whether the user want to exit , the problem is if the user do not want to exit, the original dialog will disappear,  how to fix the problem? Thanks</p>
  
  <pre><code>public static ProgressDialog showProgressDialog(final Context ctx, boolean isCancelable) {
      ProgressDialog dialog =  new ProgressDialog(ctx);
      dialog.setCancelable(false);
      dialog.setTitle(ctx.getResources().getString(R.string.system_info));
      dialog.setMessage(ctx.getResources().getString(R.string.downloading));
      dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
      dialog.setProgress(0);
  
      if (isCancelable){
          dialog.setButton(DialogInterface.BUTTON_NEGATIVE, ctx.getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                  AlertDialog.Builder builder = new Builder(ctx);
                  builder.setMessage(R.string.cancel_offline_mode);
                  builder.setTitle(R.string.system_info);
                  builder.setPositiveButton(ctx.getResources().getString(R.string.confirm), new OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                          dialog.dismiss();
                      }
                  });
                  builder.setNegativeButton(ctx.getResources().getString(R.string.cancel), null);
                  builder.create().show();
              }
          });
      }
      return dialog;
  }
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>Here is what I would expected:</p>
  
  <ol>
  <li>The first dialog showing the download progress (eg. Downloaded 60% etc..)</li>
  <li>At the first dialog there is a cancel button, if click on it show the second dialog</li>
  <li>The second dialog ask whether confirm to cancel download</li>
  <li>If confirm, do cancel()...</li>
  <li>If not , return to the first dialog and show the percentage</li>
  </ol>
  
  <p>Thanks</p>