Created
June 20, 2019 19:38
-
-
Save ceruleanotter/a82ca03605f1e21987cee813453cc8c8 to your computer and use it in GitHub Desktop.
ViewModel Integrations: Coroutines 2
This file contains 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
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