title: Trying to display a ProgressDialog in AsyncTask executed in a MapActivity
body: <p>I have a MapActivity that has code similar to this in onCreate():</p>
  
  <pre><code>if(...) {
      ...
      new FirstAsyncTask(id, this).execute((Object[]) null);
      ...
  } else {
      ...
      myLocationOverlay.runOnFirstFix(new Runnable() {
          new SecondAsyncTask(lat, lon, ActivityName.this).execute((Object[]) null);
      }
      ...
  }
  </code></pre>
  
  <p>The FirstAsyncTask and SecondAsyncTask both do different things, but both of them show a ProgressDialog like so:</p>
  
  <pre><code>public FirstAsyncTask(long id, Context context) {
      progressDialog = new ProgressDialog(context);
  }
  
  protected void onPreExecute() {
      ...
      progressDialog.show();
  }
  
  protected String doInBackground(Object... params) {
      ...
      progressDialog.dismiss();
      ...
  }
  </code></pre>
  
  <p>This is working with FirstAsyncTask, but no matter what I change in the call to SecondAsyncTask it always fails with this error: Can't create handler inside thread that has not called Looper.prepare(). I have tried setting the context parameter to "this", "ActivityName.this", getApplicationContext(), and getBaseContext().</p>
  
  <p>I'm still pretty new to Android so this idea of a "context" is confusing me. I'm even more confused that FirstAsyncTask works but SecondAsyncTask doesn't. I've seen this error mentioned a lot in other questions but none of the answers seem to work. Any ideas?</p>
  
  <p>EDIT: The exception is being thrown when the ProgressDialog is being initialized in the SecondAsyncTask's constructor.</p>