Skip to content

Instantly share code, notes, and snippets.

@Alqueraf
Created March 18, 2021 11:50
Show Gist options
  • Save Alqueraf/1aff9f35df8ec91324bf22407dff55e4 to your computer and use it in GitHub Desktop.
Save Alqueraf/1aff9f35df8ec91324bf22407dff55e4 to your computer and use it in GitHub Desktop.
Coroutine Context Switch
scope.launch(Dispatchers.IO) {
val result = apiService.getListData()
withContext(Dispatchers.Main) {
adapter.submitList(result)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment