Providing deterministic progress feedback
Knowing that something is happening is a great relief to our users, but they might be getting impatient and wondering how much longer they need to wait. Let's show them how we're getting on by adding a progress bar to our dialog.
Remember that we aren't allowed to update the user interface directly from
doInBackground(), because we aren't on the main thread. How, then, can we tell the main thread to make these updates for us?
AsyncTask comes with a handy callback method for this, whose signature we saw at the beginning of the chapter:
protected void onProgressUpdate(Progress... values)
We can override
onProgressUpdate() to update the user interface from the main thread, but when does it get called and where ...