How to display different message in progress bar in asyncTask
<p>I have to display different messages in progress dialog, when running in async task.</p>

<p>First I need to the display the message "Please wait", then "Downloading from server", then "Please wait for sometime".</p>

<p>I have tried with <code>publishProgress</code> but when I run the application, on my <code>ProgressDialog</code>, only the last message "Please wait for sometime" is displayed. How can I display the three messages?</p>

<pre><code>private class Sample extends AsyncTask&lt;String, String, String&gt; {
    ProgressDialog testdialog;

    @Override
    protected void onPreExecute() {
        testdialog = new ProgressDialog(test.this);
        testdialog.setTitle("Title");
        testdialog.setMessage("Please wait ");
        testdialog.setIndeterminate(false);
        testdialog.setCancelable(false);
        testdialog.setCanceledOnTouchOutside(false);
        testdialog.show();
    }

    @Override
    protected String doInBackground(String... urls) {
        publishProgress("Downloading from server");
        publishProgress("Please wait for sometime");
        /* here I code the background downloading process*/
    }

    @Override
    protected void onProgressUpdate(String... pro) {
        testdialog.setMessage(pro[0]);
        testdialog.setMessage(pro[1]);
    }

    @Override
    protected void onPostExecute(String result) {
        testdialog.dismiss();
    }
}
</code></pre>