title: show progress dialog from custom dialog
body: <p>I am trying to show a progress dialog from a custom dialog while an image get uploaded to a server. Here is what I have:</p>
  
  <pre><code>final Dialog mDialog = new Dialog(this, R.style.CustomDialogTheme);
  mDialog.setContentView(R.layout.sendimage_dialog);
  ImageView im = (ImageView)mDialog.findViewById(R.id.image_to_upload);
                          im.setImageURI(Constants.currImageURI);
  
  Button upload = (Button)mDialog.findViewById(R.id.upload);
  
  upload.setOnClickListener(new OnClickListener(){
  
  @Override
  public void onClick(View view) {
      mDialog.dismiss();
  
  });
  
  mDialog.show();
  
  mDialog.setOnDismissListener(new OnDismissListener(){
  
  @Override
      public void onDismiss(DialogInterface di) {
  
                                  ProgressDialog progress = new ProgressDialog(CameraActivity.this, R.style.CustomDialogTheme);
                                  progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                                  progress.setMessage("Please wait while your photo is being uploaded.");
                                  progress.show();
  
                                  String response = uploadUserPhoto(new File(getRealPathFromURI(Constants.currImageURI)));
                                  try {
                                      parseResponse(response);
                                  } catch (JSONException e) {
                                      Log.d(TAG, e.getMessage());
                                      e.printStackTrace();
                                  }
  
                                  progress.dismiss();
                                  Toast.makeText(getApplicationContext(), "Using your computer, log into your graFighters account and your image will be waiting for you.", Toast.LENGTH_SHORT).show();
  
                              }
  
                          });
  </code></pre>
  
  <p>The problem is, when I hit the upload button, my progress dialog never shows. Any ideas why this might be?</p>