Passing handlers
You can also schedule work on the main thread from the background thread using a Handler attached
to the main thread. This flow looks like Figure 26.8.
Figure 26.8 Scheduling work on the main thread from ThumbnailDownloader’s
thread
The main thread is a message loop with handlers and a Looper. When you create a Handler in the
main thread, it will be associated with the main thread’s Looper. You can then pass that Handler to
another thread. The passed Handler maintains its loyalty to the Looper of the thread that created it.
Any messages the Handler is responsible for will be handled on the main thread’s queue.