January 2012
Intermediate to advanced
282 pages
7h 4m
English
Android defines two classes in the android.os package that will often be the cornerstones of the interthread communication in your multithreaded applications:
While creating an AsyncTask object hides the Handler and Looper details from you, in some cases you need to use handlers and loopers explicitly, for example when you need to post a Runnable to a thread other than the main thread.
Listing 5–2 gave you a glimpse of how the Handler and Looper work together: you use a Handler object to post a Runnable in a Looper's message queue. Your application's main thread already has a message queue, so you don't have to create one explicitly. However, the threads you create do not come automatically with ...