title: AsyncTask not showing the ProgressDialog
body: <p>I am using an AsyncTask (which I am starting in my main activity) to load some data:</p>
  
  <pre><code>Context context = VehicleTabView.this;
  ProgressDialog progressDialog = new ProgressDialog(context);
  progressDialog.setMessage("Loading...");
  new LoadingVehicles(context, progressDialog).execute(null, null, null);
  </code></pre>
  
  <p>Here is the AsyncClass:</p>
  
  <pre><code>package com.example.schedule_vehicles;
  
  import com.example.utils.VehicleNames;
  
  import android.app.ProgressDialog;
  import android.content.Context;
  import android.os.AsyncTask;
  
      // Showing a ProgressDialog once loading the list of vehicles is completed using an AsyncTask
      public class LoadingVehicles extends AsyncTask&lt;Void, Void, Void&gt; {
      Context context;
      ProgressDialog progressDialog;
  
      public LoadingVehicles(Context context, ProgressDialog progressDialog) {
          this.context = context;
          this.progressDialog = progressDialog;
      }
  
      @Override
      protected void onPreExecute() {
          progressDialog.show();
      }
  
      @Override
      protected Void doInBackground(Void... params) {
          new VehicleNames(context);
  
          return null;
      }
  
      @Override
      protected void onPostExecute(Void result) {
          progressDialog.dismiss();
      }
  }
  </code></pre>
  
  <p>The problem that the ProgressDialog is not showing on the screen. </p>
  
  <p>I type Log.d, to see if the program is going through all the phases - onPreExecute, doInBackground, onPostExecute, and it is going through all the phases and doing the job that I need. <strong>But</strong> the ProgressDialog is not showing. I read a lot of information about this thing and it seems that the PRE and POST execute are started by the main thread, which is blocked by the DOINBACKGROUND method, and this is the reason not to see the ProgressDialog. I tried to find some answer how this is solved - but no success. </p>
  
  <p>If anyone faced this, please share your experience. THANKS a lot!</p>