title: Loading Image using picasso inside AsyncTask
body: <p>I'm using picasso to load an image as a background for my activity, I want to use an AsyncTask, while the image is loading, when done the progress bar dismisses to give better appearance to my application,</p>
  
  <p>Here is my code :</p>
  
  <pre><code>  private class RemoteDataTask extends AsyncTask&lt;Void, Void, Void&gt; {
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          mProgressDialog = new ProgressDialog(MainActivity.this);
          mProgressDialog.setMessage("Chargement...");
          mProgressDialog.setIndeterminate(false);
          mProgressDialog.show();
  
      }
  
      @Override
      protected Void doInBackground(Void... params) {
             Picasso.with(MainActivity.this).load("http://tv2.orangeadd.com/mediacenter-data/ofc__bg_home.jpg").into(background,new com.squareup.picasso.Callback() {
                   @Override
                   public void onSuccess() {
                 mProgressDialog.dismiss();
                   }
  
                   @Override
                   public void onError() {
  
                   }
               }); 
          return null;
      }
      @Override
      protected void onPostExecute(Void result) {
  
  
  
  
  
      }
      }
  </code></pre>
  
  <p>this is always showing an error and forcing my application to quit !</p>
  
  <p>Thank's guys :)</p>