October 2019
Intermediate to advanced
434 pages
11h 54m
English
Coroutine builders are extension functions of the CoroutineScope class that can be used to launch coroutines with different characteristics. If we look back at our working example, we can see an example of the launch() builder:
fun main() { GlobalScope.launch { delay(500) println("Coroutines") } println("Hello") Thread.sleep(1000)}
By calling launch(), we can start a new coroutine without blocking the current thread. There are a variety of other coroutine builders available to us, including the following:
Read now
Unlock full access