Not able to publish progress from async task do in background's while loop - Android

前端 未结 2 1756
自闭症患者
自闭症患者 2021-01-24 00:27

I want to update dialog\'s download progress from doInBackground.
I am printing log as well as publishing progress.
Neither of them are working.

It up

2条回答
  •  暖寄归人
    2021-01-24 01:08

    remove super from onProgressUpdate and then try

    @Override
    protected void onProgressUpdate(Void... values) {
        //super.onProgressUpdate(values);
        mProgressDialog.setProgress(progress);
    }
    

    if it doesn't work than add a sleep statement in your loop so that this loop will free the processor and give time to publish the progress

    try {
        Thread.sleep(200);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    

提交回复
热议问题