Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pencelab/3ae4da988606f547e8b68b6838b3be80 to your computer and use it in GitHub Desktop.
Save pencelab/3ae4da988606f547e8b68b6838b3be80 to your computer and use it in GitHub Desktop.
suspend fun loadItems() {
withContext(Dispatchers.Main) {
showLoadingView()
}
withContext(Dispatchers.IO) {
val data = requestData()
}
withContext(Dispatchers.Main) {
hideLoadingView()
appendItemsToListView(data)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment