Reputation: 337
When I use CountDownLatch, the application freezes until the result is received, it is fashionable to avoid this?
Upvotes: 0
Views: 180
Reputation: 514
You can do it in another thread. Also you can do it in coroutines
I recommend get data with
CoroutineScope(Dispatchers.IO).launch {
val dat = getdata()
launch(Dispatchers.Main){ setInMyView(dat) }
}
Upvotes: 1