Can I update the ProgressDialog string message?

I installed progressialogog on Android AsyncTak and it works.

My question is: is it possible to update in the onProgressUpdate AsyncTask method the string displayed in ProgressDialog. I would like to update the line by calling publishProgress to show the progress of the task.

I can update the line if instead of progressDialog I have my own text view. ProgressDialog looks better and has a spinning wheel.

+4
source share
2 answers

Yes, you can. Just call myProgressDialog.setMessage("My New Message"); in onProgressUpdate method

+8
source

If you change the message more than once:

 @Override protected void onProgressUpdate(final String... values) { runOnUiThread(new Runnable() { @Override public void run() { progress.setMessage(values[0]); } }); } 
0
source

Source: https://habr.com/ru/post/1339896/


All Articles