title: ProgressDialog.show takes 1.5 minutes to return
body: <p>We developed a new version of an application back in October and this problem was not noticed at the time, so probably didn't occur. This code has not changed, but what has changed is the versions of Android. We're even seeing this on devices running 4.4.2, so it's not just a lollipop issue.</p>
  
  <p>I have a "static" class that is used throughout the application to show and close progress dialogs. The relevant methods from that class are included in the code block below. I've added some timing around the API call that's in question and also included the result from a couple of calls. progressDialog is a static field on the class used to track the currently opened dialog so it can be closed.</p>
  
  <pre><code>/**
   * Shows the progress dialog box, allowing for the message and title to be supplied.
   * The progress dialog will be indeterminate and not cancelable.
   *
   * @param context The context that owns the dialog.
   * @param message The message to display in the dialog.
   * @param title   The title for the dialog box.
   */
  public static void showProgressDialog ( Context context, String message, String title ) {
      closeProgressDialog();
      String actualTitle = OverrideProgressDialogTitle ? DefaultProgressDialogTitle : title;
      String actualMessage = OverrideProgressDialogMessage ? DefaultProgressDialogMessage : message;
  
      Date start = new Date();
      progressDialog = ProgressDialog.show( context, actualTitle, actualMessage, true, false );
      Date end = new Date();
  
      Log.v( LogTag, String.format("It took %s minutes to show the dialog.", DateUtils.millisecondsToMinutes( end.getTime() - start.getTime() ) ) );
  }
  
  /**
   * Closes the progress dialog box if it is opened.
   */
  public static void closeProgressDialog () {
      if ( progressDialog != null &amp;&amp; progressDialog.isShowing() ) {
          try {
              progressDialog.dismiss();
          }
          catch ( Exception e ) {
              Log.e( LogTag, "Error closing dialog.", e );
          }
      }
      progressDialog = null;
  }
  </code></pre>
  
  <p>Here are some timings:</p>
  
  <pre><code>It took 0.0013666668 minutes to show the dialog. 
  It took 3.8333333E-4 minutes to show the dialog. 
  It took 3.6666667E-4 minutes to show the dialog. 
  It took 1.4308 minutes to show the dialog.
  </code></pre>
  
  <p>The result is very repeatable... the first time in the app on 2 particular screens when the dialog is shown, it takes about 1.5 minutes to return from the call to ProgressDialog.show but subsequent calls to show the dialogs from those same places return almost immediately. In one case, the dialog is being shown from the onStart method of a fragment to load data, in the other case it is being shown when a button is clicked that submits data to the server.</p>
  
  <p>Has anyone seem this method call take a long time to return and if so, how did you resolve it?</p>
  
  <p><strong>EDIT: I actually tracked this down further and it's some other issue causing the hang up. There seems to be at times a long delay between when an AsyncTask's onPreExecute method completes and when doInBackground begins.</strong> </p>