Coroutines: simplify threading on android

Android runs on Java and by default Java threads execute once, and once only. On a platform like Android where the UI is constantly updating, creating new threads for every action quickly becomes expensive. To get around this Android’s main thread uses the HandlerThread which is a subclass of the Java Thread. Android keeps this main thread alive by using a Looper which schedules Messages (Runnables) to execute.

These messages are run sequentially, which is why performing long running messages on the main thread will block subsequent messages waiting to be…