In AsyncTask How to pass data from doInBackground() to main UI “instantly” and not after each loop? (BufferedReader)

前端 未结 1 1511
耶瑟儿~
耶瑟儿~ 2021-01-07 07:09

EDIT1:

I did change the code such that the update was done within the while loop. HOWEVER, NO CHANGE. SHOWN THIS IN CODE BELOW. ALSO, removed other

相关标签:
1条回答
  • 2021-01-07 07:52

    onProgressUpdate runs in the UI thread.

    So you should be able to interact with the UI with this method, inside your loop. However, try to use the given parameter of the method :

    protected void onProgressUpdate(String... values)
    {
        results1.append(values[0]);
        results1.append("\n");
    }
    

    Calling super.onProgressUpdate(values); is useless as the default implementation is empty.

    0 讨论(0)
提交回复
热议问题