Note that there are some explanatory texts on larger screens.

plurals
  1. POChange a dialog's message while using AsyncTask?
    primarykey
    data
    text
    <p>I looked at a few other questions regarding a similar issue, and I figured out that I need to use the <code>onProgressUpdate</code> method to change the message of <code>ProgressDialog</code>. </p> <p>For example, I have code like this that runs in the <code>AsyncTask</code>'s <code>doInBackGround</code> (this is just a very small sample):</p> <pre><code> byte[] data = getBytesFromFile(image); String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; pictures.dia.setProgress(30); pictures.dia.setMessage("Data beginning upload sequence..."); URL connectURL = new URL(this.base_url); HttpURLConnection conn = (HttpURLConnection) connectURL.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("Content-Type", "multipart/form-data, boundary=" + boundary); DataOutputStream dos = new DataOutputStream(conn.getOutputStream()); pictures.dia.setProgress(40); pictures.dia.setMessage("Output Stream prepared..."); </code></pre> <p>When I originally run thus, I get a Leaky Window error saying that I can't change <code>dia</code>'s message outside of <code>AsyncTask</code>.</p> <p>So my question is, how do I use <code>onProgressUpdate</code> to set the message of <code>dia</code> when <code>dia</code>'s progress reaches a certain number? (i.e., when <code>dia</code>'s progress = 30, make it say "Data beginning upload sequence...")<br> <code>onProgressUpdate</code> must obviously always be checking <code>dia</code>'s progress (like a listener, I suppose)[if it doesn't already do this, how can I make it do this?]</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload