January 2012
Intermediate to advanced
282 pages
7h 4m
English
Very often, your application has to deal with the sequence that was shown in Listing 5–2:
To simplify this common pattern, Android defines the AsyncTask class in Android 1.5 and above. The AsyncTask class allows your application to easily perform a background operation and publish the result in the UI thread. Threads, Runnables, and other related objects are hidden from you for simplicity. Listing 5–5 shows how you would implement the sequence from Listing 5–2 using the AsyncTask class.
Listing 5–5. Using AsyncTask
public void onClick (View v) { // AsyncTask<Params, Progress, Result> ...