开发者

Can I Update the string message of a ProgressDialog?

I set up a progressdialog in an Android AsyncTak and it works.

My question is it possible to update in the onProgressUpdate method of the AsyncTask the string that the ProgressDialog displays. I would like to update the string with a publishProgress call to show progress of the task.

I can update the string if instead of the progressDialog开发者_运维问答 I have my own textview. The progressDialog looks better and has the spinning wheel.


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


If you'll change message more then once:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜