title: Android ProgressDialog showing but progress not updated
body: <p>I am trying to update the progress bar after creation (both in AsyncTask). The progress dialog shows up and dismisses but not updated, it is always set to 0. Here is my code:
      public class ImageTask extends AsyncTask
      {</p>
  
  <pre><code>    @Override
      protected Void doInBackground(String... saleId) {
  
          //Drawable drawable = getActivity().getResources().getDrawable(R.drawable.sale_image_holder);
          //Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
          //ByteArrayOutputStream stream = new ByteArrayOutputStream();
          //bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
          //byte[] imageInAsByteArray = stream.toByteArray(); // here
          ImgService imgService = new ImgService();
          imgService.addImgToSale(imageInAsByteArray, saleId[0], this);
          return null;
      }
  
      @Override
      protected void onProgressUpdate(Integer... progress) 
      {
          super.onProgressUpdate(progress);
          dialog.setProgress(progress[0]);
      }
  
      @Override
      protected void onPostExecute(Void result) {
          dialog.dismiss();
      }
  
      public void doProgress(int value){
          publishProgress(value);
      }
  }
  </code></pre>
  
  <p>here is the ImgService class:</p>
  
  <pre><code>public class ImgService 
  {
      public void addImgToSale(byte[] img, final String saleId, final ImageTask task)
      {
          final ParseFile file = new ParseFile(saleId + ".jpeg", img);
          try {
              file.save();
          } catch (ParseException e1) {
              e1.printStackTrace();
              return;
          }
          task.doProgress(50);
          ParseObject image = new ParseObject(DBDictionary.SALE_IMAGES);
          ParseObject sale = new ParseObject(DBDictionary.SALE);
          sale.setObjectId(saleId);
          image.put(DBDictionary.SALE_IMAGES_SALE_ID_P, ParseObject.createWithoutData(DBDictionary.SALE, saleId));
          image.put("image", file);
          try {
              image.save();
          } catch (ParseException e1) {
              e1.printStackTrace();
              return;
          }
          task.doProgress(100);
      }
  }
  </code></pre>
  
  <p>In the net I found many problems with showing and dismissing the ProgressDialog but not with the progress updating. </p>
  
  <p>Thanks! </p>