title: progressDialog stops to update when I rotate screen
body: <p>I'm with a little problem that is driving me crazy. I'm using a AsyncTask in a retained Fragment to update a progressDialog in my activity. I'm using callbacks to send the progress from my fragment. </p>
  
  <p>The problem is: When I rotate my screen it simply stops do update the progressDialog in the recreated activity. It seems like onProgressUpdate stops to being called in the rotated activity.</p>
  
  <p>the relevant part of the code is shown below:</p>
  
  <p><strong>Worker Fragment</strong></p>
  
  <pre><code>public class WorkerFragment extends Fragment {
  
      Context mContext;   
  
      ...
  
      public static interface TaskCallbacks {
          void onPreExecute();
          void onProgressUpdate(int... progress);
          void onPostExecute();           
      }
  
      @Override
      public void onAttach(Activity activity) {       
          super.onAttach(activity);
          mCallbacks = (TaskCallbacks) activity;
      }
  
      @Override
      public void onDetach() {
          super.onDetach();
          mCallbacks = null;
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);   
        // Retain this fragment across configuration changes.
        setRetainInstance(true);      
      }
  
      //inner class
      class DownloadFileFromURL extends AsyncTask&lt;String, Int, Void&gt; {
  
          @Override
          public void onPreExecute() {
              if (mCallbacks != null) {
                  mCallbacks.onPreExecute();
          }
  
          @Override
          public String doInBackground(String... f_url) {
            ... //some verifications of files
              if(!localFile.exists()){
                  //http connection, check, buffer, inputstream, etc...
                  publishProgress((int)((bytesDownloaded*100)/remoteFileSize));
                  ...
              }
          }
  
          @Override
          protected void onProgressUpdate(int... percent) {
              if (mCallbacks != null) {
                  mCallbacks.onProgressUpdate(percent);
              }
          }
  
          ... 
  
      }
  }
  </code></pre>
  
  <p><strong>and the Activity</strong></p>
  
  <pre><code>public class Updater extends Activity implements WorkerFragment.TaskCallbacks {
      private WorkerFragment myWorker;
      private ProgressDialog pDialog;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_updater);
          pDialog=null;
          showDialog(1);
  
          FragmentManager fm = getFragmentManager();
          myWorker = (WorkerFragment) fm.findFragmentByTag("task");
          if(myWorker == null)
          {
              myWorker = new WorkerFragment();
              fm.beginTransaction().add(myWorker, "task").commit();               
          }
  
          @Override
          protected Dialog onCreateDialog(int id) {
              switch (id) {
              case 1:
                  pDialog = new ProgressDialog(this);
                  pDialog.setMessage("Baixando arquivos de mídia");
                  pDialog.setIndeterminate(false);
                  pDialog.setMax(100);
                  pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                  pDialog.setCancelable(false);
                  pDialog.show();
                  dialogType=progress_bar_type;
                  return pDialog;
               }
           }
  
          @Override
          public void onProgressUpdate(int... progress) {
          //setting progress percentage
              if(pDialog!=null)
              {
                   pDialog.setProgress(progress[0]);
              }
          }
  
          @Override
          public void onPostExecute(){ 
              if(pDialog!=null)
              {
                   dismissDialog(1);
                   ...
              }
          }
  </code></pre>