is it possible to post values to a mutable livedat...
# android
m
is it possible to post values to a mutable livedata from a coroutine? i’m trying to emit state updates from a long-running background process. something like this: (apologies for using experimental still)
Copy code
fun doLongProcess() = runBlocking {
    async {
        state.postValue("starting process")
        startLongProcess()
    }
}
r
You should use the 1.0 version. Time to upgrade, the IDE will help you migrate once you update. I would think so, just remember to use CoroutineScope, and Dispatchers.MAIN
m
withContext(Dispatchers.MAIN) { liveData.postValue(xxx) }