Created
March 7, 2022 02:30
-
-
Save KhomDrake/53aa7c9932eb186b108dffa14e43c2e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun loadMovies() { | |
backgroundScope.launch { | |
val movies = loadMovies() // load the movies on the background thread | |
launch(Dispatchers.Main) { // to touch the views to show the movies, we need to launch another coroutine in the main thread | |
showMovies(movies) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment