Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You should run all your run logging tasks in this single <code>AsyncTask</code>. It's perfectly fine to do this as it already provides you with a background thread do to all your processing.</p> <p>Just do all your http processing in the main doInBackGround method. </p> <p>Whenever you want to update the UI you have 2 hooks:</p> <ul> <li><code>onPostExecute</code> : This gets called when the doInBackground completes. Put all logic here that you want to perform on the UI when your background processing is done completely. </li> <li><code>onProgressUpdate</code> : This gets called whenever you call <code>publishProgress</code> from within the <code>doInBackground</code> method. Do this whenever you want to update the UI while your background processing is still ongoing. It allows you to show intermediate progress. This will cause the AsyncTasks <code>onProgressUpdate</code> to be called automatically where you can update your UI.</li> </ul> <p>If the adapter used to back your ListView is a member variable of the activity class then you can reference it from onPostExecute and onProgressUpdate meaning you'll be able to update your list either when </p> <ul> <li>the background processing has completed (<code>onPostExecute</code>)</li> <li>when background processing is still ongoing (<code>onProgressUpdate</code>)</li> </ul> <p>An example is shown here : <a href="http://developer.android.com/reference/android/os/AsyncTask.html" rel="nofollow">http://developer.android.com/reference/android/os/AsyncTask.html</a></p> <p>Nested <code>AsynTasks</code> are not supported (and could never work).</p>
 

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