Santiago Laport
07/30/2020, 9:53 PMfun method(){
viewModelScope.launch {
val result1 = getSomeData1()
val result2 = getSomeData2()
val result3= getSomeData3()
...
}
}
suspend fun getSomeData1() : String? = suspendCoroutine { continuation ->
someInstance.addListener(SomeListener {
continuation.resume(data)
})
}
...
First time works well, but sometimes I need to execute again and I get the next exception:
IllegalStateException : Already resumed
this occurs in in the continuation.resume
octylFractal
07/30/2020, 9:56 PMoctylFractal
07/30/2020, 9:56 PMkevindmoore
07/30/2020, 10:12 PMSantiago Laport
07/30/2020, 10:26 PM