What's handler?

Copied from https://developer.android.com/reference/android/os/Handler.html

Handler is part of the Android system's framework for managing threads. You create a Handler for a new thread, but you can also create a Handler that's connected to an existing thread. When you connect a Handler to your UI thread, the code that handles messages runs on the UI thread.

A Handler allows you to send and process Message and Runnable objects associated with a thread's MessageQueue.

Each Handler instance is associated with a single thread and that thread's message queue.

There are two main uses for a Handler:

  1. to schedule messages and runnables to be executed as some point in the future; and
  2. to enqueue an action to be performed on a different thread than your own.