【发布时间】:2020-03-26 12:05:09
【问题描述】:
我正在使用 kotlin Coroutines 执行异步网络操作以避免NetworkOnMainThreadException。
问题是我使用runBlocking 时发生的延迟,这需要一些时间才能完成当前线程。
我怎样才能防止这种延迟或滞后,并允许异步操作无延迟地完成
runBlocking {
val job = async (Dispatchers.IO) {
try{
//Network operations are here
}catch(){
}
}
}
【问题讨论】:
标签: android kotlin delay coroutine