title: Android progress dialoge view not showing
body: <p>i have developed a simple AsyncTask class that takes Handlers as its parameters and whilst sending HandlersendEmptyMessage(0) in the doBackground i load up a ProgressDialoge loading view but for some reason it doesnt show until the very end of executing the stuff thats inside my Handler object (in other words the progressDialogue blinks at the end).</p>
  
  <p>here is my AsyncTask:</p>
  
  <pre><code>package com.kc.util;
  
  import android.app.ProgressDialog;
  import android.content.Context;
  import android.os.AsyncTask;
  import android.os.Handler;
  import android.util.Log;
  
  public class LoadDialoge extends AsyncTask&lt;Handler, Integer, Void&gt; {
  
      private ProgressDialog progressDialog;
      private String TAG = "LoadDialoge";
      private Context mContext;
  
      @Override
      protected void onPostExecute(Void result) {
          // TODO Auto-generated method stub
          super.onPostExecute(result);
          progressDialog.dismiss();
      }
  
      @Override
      protected void onPreExecute() {
          // TODO Auto-generated method stub
          super.onPreExecute();
          showWait();
      }
  
      @Override
      protected Void doInBackground(Handler... params) {
          // TODO Auto-generated method stub
          for(Handler mHandler : params){
              mHandler.sendEmptyMessage(0);
              Log.d(TAG, "handler sending message" );
          }
          return null;
      }
  
      private void showWait() {
          Log.d(TAG, "showWait");
          progressDialog = new ProgressDialog(mContext);
          progressDialog.setTitle("Retrieving contact details");
          progressDialog.setMessage("Please wait...");
          progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
          progressDialog.show();
          Log.d(TAG, "    ");
      }
  
      public void setmContext(Context mContext) {
          this.mContext = mContext;
      }
  
  
  
  }
  </code></pre>
  
  <p>And here is the handler i passed to this class from an Activity:</p>
  
  <pre><code>private Handler mHandler = new Handler() {
  
          @Override
          public void handleMessage(Message msg) {
              // TODO Auto-generated method stub
              super.handleMessage(msg);
              Log.d(TAG, "handleMessage");
              initialiseOnItemClickListeners();
              initialiseOnClickListeners();
              initialiseListViewAdapters();
              loadDataToDb();
              initializeTitles();
              initialize();
          }
  
      };
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.abstract_main_menu);
  
          LoadDialoge load = new LoadDialoge();
          load.setmContext(this);
          load.execute(mHandler);
  
      }
  </code></pre>
  
  <p>Im trying to create a generic Async Load screen that works across any activity that wants to use it instead of copying and pasting the above LoadDialogue AsyncTask across each activity(which i was doing before and worked fine).</p>