How to show progress bar status by percentage while uploading json data?

前端 未结 5 1438
旧巷少年郎
旧巷少年郎 2020-12-20 15:55

I am uploading string and photo.and its working fine. Now I want to show progress bar while uploading data with percentage but percentage show very quickly to 100 percentage

5条回答
  •  一向
    一向 (楼主)
    2020-12-20 16:36

    Make sure to flush inside the while loop before updating progress:

    while (bytesTransferred < totalSze) {
       ...
       wr.flush();
       publishProgress((int)rounded);
       ...
    }
    

提交回复
热议问题