Kotlin Coroutines the right way in Android
After struggling with this question for days, I think the most simple and clear async-await pattern for Android activities using Kotlin is: override fun onCreate(savedInstanceState: Bundle?) { //… loadDataAsync(); //”Fire-and-forget” } fun loadDataAsync() = async(UI) { try { //Turn on busy indicator. val job = async(CommonPool) { //We’re on a background thread here. //Execute blocking … Read more