The HandlerThread
is a convenience class that initiates a Looper
within a Thread to process Runnable or Message objects.
The Handler
is used to handle the insertion of the Runnable
or Message
objects into the looper's queue:
The Handler
class supports several other ways to schedule a Message to be processed at a future time:
- sendMessage - Pushes a message onto the end of the message queue.
- sendMessageDelayed - Pushes a message onto the end of the message queue.
- sendMessageAtTime - Pushes a message onto the end of the message queue.
- sendEmptyMessage - Sends Message containing only a single int code.
- sendEmptyMessageDelayed - Sends Message to be delivered after the specified time elapses.
- sendEmptyMessageAtTime - Sends Message to be delivered at the specified absolute time.
handlerThread.quit(); // quits immediately