title: ProgressDialog Not Dismissing in AsyncTask
body: <p>I have an app that propogates a spinner from a website inside an AsyncTask. Without a ProgressDialog, I am stuck with an empty spinner until it loads. With a ProgressDialog, the network operation never finishes and the ProgressDialog stays up forever. Here is my code:</p>
  
  <pre><code>class TheaterGetter extends AsyncTask&lt;Void, Void, Document&gt; {   
      private Context context;
      private ProgressDialog dialog;
  
      public TheaterGetter(Context context) {
          this.context = context;
          dialog = new ProgressDialog(context);
      }
  
      @Override
      protected void onPreExecute() {
          dialog.setMessage(((Activity) context).getString(R.string.loading_theaters));
          dialog.setCancelable(false);
          dialog.show();
      }
  
      protected Document doInBackground(Void...voids) {
          Document doc = null;
          try {
              doc = Jsoup.connect("http://landmarkcinemas.com").timeout(10000).get();
          } catch (IOException e) {
              Log.e("landmark cinemas connection error", e.getMessage());
          }
          return doc;
      }
  
      protected void onPostExecute(Document doc) {
          Element allOptions = doc.select("select[id=campaign").first();
          Elements options = allOptions.getElementsByTag("option");
          options.remove(0);
          TreeMap&lt;String, String&gt; theaters = new TreeMap&lt;String, String&gt;();
          for (Element option:options) {
              theaters.put(option.html(), option.attr("value"));
          }
          final TreeMapSpinAdapter adapter = new TreeMapSpinAdapter(context, android.R.layout.simple_spinner_item, theaters);
          final Spinner spinner = (Spinner) ((Activity) context).findViewById(R.id.spinner1);
          spinner.setAdapter(adapter);
          spinner.setOnItemSelectedListener(new OnItemSelectedListener(){
              @Override
              public void onItemSelected(AdapterView&lt;?&gt; parent, View view,
                      int pos, long id) {
                  MainActivity.setTheater((String) adapter.getItem(pos));
              }
  
              @Override
              public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
                  // TODO Auto-generated method stub
              }
          });
          dialog.dismiss();
      }
  }
  </code></pre>