title: Updating progress dialog in Activity from AsyncTask
body: <p>In my app I am doing some intense work in <code>AsyncTask</code> as suggested by Android tutorials and showing a <code>ProgressDialog</code> in my main my activity:</p>
  
  <pre><code>dialog = ProgressDialog.show(MyActivity.this, "title", "text");
  new MyTask().execute(request);
  </code></pre>
  
  <p>where then later in <code>MyTask</code> I post results back to activity:</p>
  
  <pre><code>class MyTask extends AsyncTask&lt;Request, Void, Result&gt; {
  
      @Override protected Result doInBackground(Request... params) {
          // do some intense work here and return result
      }
  
      @Override protected void onPostExecute(Result res) {
          postResult(res);
      }
  }
  </code></pre>
  
  <p>and on result posting, in main activity I hide the dialog:</p>
  
  <pre><code>protected void postResult( Result res ) {
      dialog.dismiss();
      // do something more here with result...
  }
  </code></pre>
  
  <p>So everything is working fine here, but I would like to somehow to update the progress dialog to able to show the user some real progress instead just of dummy "Please wait..." message. Can I somehow access the progress dialog from <code>MyTask.doInBackground</code>, where all work is done? </p>
  
  <p>As I understand it is running as separate Thread, so I cannot "talk" to main activity from there and that is why I use <code>onPostExecute</code> to push the result back to it. But the problem is that <code>onPostExecute</code> is called only when all work is already done and I would like to update progress the dialog in the middle of doing something.</p>
  
  <p>Any tips how to do this?</p>