Kotlin Coroutines the right way in Android

前端 未结 9 1065
醉酒成梦
醉酒成梦 2020-12-02 06:51

I\'m trying to update a list inside the adapter using async, I can see there is too much boilerplate.

Is it the right way to use Kotlin Coroutines?

can this

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 07:01

    I think you can get rid of runOnUiThread { ... } by using UI context for Android applications instead of CommonPool.

    The UI context is provided by the kotlinx-coroutines-android module.

提交回复
热议问题