Slide 50
Slide 50 text
val UI = HandlerContext(Handler(Looper.getMainLooper()), “UI")
public class HandlerContext(
private val handler: Handler,
private val name: String? = null
) : CoroutineDispatcher(), Delay {
…
override fun dispatch(context: CoroutineContext, block: Runnable) {
handler.post(block)
}
launch(UI) {
val response = api.fetch()
Snackbar.make(view, "code:${response.code}", Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
}
"OESPJEך)BOEMFS⡲