title: android progress dialog doesn't show percent
body: <p>Dialog doesn't show me percent If I've used code</p>
  
  <pre><code>    final Handler handler = new Handler() {
      public void handleMessage(Message msg) {
          int total = msg.arg1;
          mProgressDialog.setProgress(total);
          if (total &gt;= 100){
              try {
                  mProgressThread.sleep(100);
              } catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              dismissDialog(DIALOG_DOWNLOAD_PROGRESS);
              mProgressThread.setState(ProgressThread.STATE_DONE);
          }
      }
  };
  </code></pre>
  
  <p>and in thread code</p>
  
  <pre><code>while ((count = input.read(data)) != -1) {
                  total += count;
                  Message msg = mHandler.obtainMessage();
                  msg.arg1 = total;
                  mHandler.sendMessage(msg);
                  output.write(data, 0, count);
              }
  </code></pre>
  
  <p>What's wrong? If I use total++; instead total +=count; the scale raise to 19 percent but doesn't raise to 100%. It is because the file is download faster than the while loop 100 iteration.
  If I use total += count; It shows 0 but the the scale is on 100% the file is downloaded.</p>