Satheesh Reddy
What is looper, handler, and message queue in Android?
By Satheesh Reddy in Android on Jan 21 2014
  • Munesh Sharma
    Apr, 2014 23

    A Looper is a message handling loop: it reads and processes items from a MessageQueue. The Looper class is usually used in conjunction with a LooperThread (a subclass of Thread).A Handler is a utility class that facilitates interacting with a Looper—mainly by posting messages and Runnable objects to the thread's MessageQueue. When a Handler is created, it is bound to a specific Looper (and associated thread and message queue).In typical usage, you create and start a LooperThread, then create a Handler object (or objects) by which other threads can interact with the LooperThread instance. The Handler must be created while running on the LooperThread, although once created there is no restriction on what threads can use the Handler's scheduling methods (post(Runnable), etc.)The main thread (a.k.a. UI thread) in an Android application is set up as a looper thread before your application is created.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS