Skip to content

Instantly share code, notes, and snippets.

@ceruleanotter
Created June 20, 2019 19:38
Show Gist options
  • Save ceruleanotter/a82ca03605f1e21987cee813453cc8c8 to your computer and use it in GitHub Desktop.
Save ceruleanotter/a82ca03605f1e21987cee813453cc8c8 to your computer and use it in GitHub Desktop.
ViewModel Integrations: Coroutines 2
class MyViewModel() : ViewModel() {
fun initialize() {
viewModelScope.launch {
processBitmap()
}
}
suspend fun processBitmap() = withContext(Dispatchers.Default) {
// Do your long running work here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment