Android - AsyncTask, are all progressPublish calls published?


onProgressUpdate(Progress...), invoked on the UI thread after a call to publishProgress(Progress...). The timing of the execution is undefined. This method is used to display any form of progress in the user interface while the background computation is still executing. For instance, it can be used to animate a progress bar or show logs in a text field.

It also says the timing is undefined, not that stuff actually gets published.

I can see a case for only publishing the latest progress submitted, and for all.

Suppose there is a huge lack spike and 100 progress updates have been published, why not discard the old 99 - if it is for progress bars and such, or showing what is currently loading, why bother to flick through?

But if it doesn't discard any progress updates and publishes them in order, this'd be a great way to "stream" any sort of list structure from a background thread, rather than storing all these results and returning a list when it completes.

Does async task publish all progress updates in the order it received them (And before it runs the post execute stuff)

I cannot test the behaviour because it is not deterministic, I could be lucky or my device could be fast, this is why I ask. You should never test (and infer properties from) anything to do with threads (if this saves one newbie, it was worth writing)


Well here's the source. And here's the relevant section that does indeed seem to indicate that every call to publishProgress results in an accompanying call to onProgressUpdate.

     * This method can be invoked from {@link #doInBackground} to
     * publish updates on the UI thread while the background computation is
     * still running. Each call to this method will trigger the execution of
     * {@link #onProgressUpdate} on the UI thread.
     * {@link #onProgressUpdate} will note be called if the task has been
     * canceled.
     * @param values The progress values to update the UI with.
     * @see #onProgressUpdate
     * @see #doInBackground
    protected final void publishProgress(Progress... values) {
        if (!isCancelled()) {
                    new AsyncTaskResult<Progress>(this, values)).sendToTarget();

Need Your Help application runs on only vs2010 installed machines

.net visual-studio-2010

I hae created a simple application with visual studio 2010 and I got the .exe file from release directory after building.

bootstrap loading button state not working

javascript jquery twitter-bootstrap

I want my button to change to a loading state as per the boostrap documentation