title: Display ProgressBar while saving an image from Activity
body: <p>In my app I am letting user save a drawing. While the drawing is saved, I want to display a progress bar on top of the drawing to let the user know it is saving.</p>
  
  <p>My XML layout:</p>
  
  <pre><code>&lt;FrameLayout
      android:id="@+id/viewd"
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="3"
      android:orientation="vertical"
      android:layout_gravity="center" &gt;
      &lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:padding="0dp"
          android:background="@drawable/bd"
          android:id="@+id/llFreeDraw" &gt;
      &lt;/LinearLayout&gt;
      &lt;ProgressBar 
          android:layout_height="fill_parent"
          android:layout_width="fill_parent"
          style="@android:style/Widget.ProgressBar.Large"
          android:id="@+id/pbSave"
          android:visibility="invisible" /&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>Portion of my Java code is:</p>
  
  <pre><code>View.OnClickListener saveHandle = new View.OnClickListener() {
      public void onClick(View v) {
          savePB = (ProgressBar) findViewById(R.id.pbSave);
          savePB.setVisibility(View.VISIBLE);
          View content = layout;
          content.setDrawingCacheEnabled(true);
          content.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
          Bitmap bitmap = content.getDrawingCache();
          File folder = new File(Environment.getExternalStorageDirectory() + "/PB");
          if (!folder.exists()) {
              folder.mkdir();
          }
          file = new File(folder + "/pb_image_" + Math.random()  + ".png");
          FileOutputStream ostream;
          try {
              file.createNewFile();
              ostream = new FileOutputStream(file);
              bitmap.compress(CompressFormat.PNG, 100, ostream);
              ostream.flush();
              ostream.close();
              displayToast("Image was saved.");
              savePB.setVisibility(View.GONE);
              btnSave.setVisibility(View.GONE);
              btnShare.setVisibility(View.VISIBLE);
          } catch (Exception e) {
              e.printStackTrace();
              displayToast("Unable to save image. Try again later.");
          }
      }
  };
  </code></pre>
  
  <p>I want to display the progress bar on top of the framelayou, with a 25% transparent background. The image is saving but I do not see the progress bar. Any idea how to modify so it works the way I am wanting it to?</p>