lenqnr
07/05/2019, 12:13 PMDialogFragment
that calls a `ViewModel`'s method, and the method calls a suspending method via viewModelScope.launch
. The problem is, when I click OK button on the dialog, I get kotlinx.coroutines.JobCancellationException: Job was cancelled
error message and the suspending method doesn't work. How can I overcome this problem? I moved the method to my MainViewModel
and accessed it with sharedViewModel
, but still the same JobCancellationException
occured.rkeazor
07/05/2019, 12:21 PMlenqnr
07/05/2019, 12:33 PMfun doSomething() = viewModelScope.launch {
<http://httpClient.post|httpClient.post><Unit>("<http://example.com>")
}
rkeazor
07/05/2019, 12:45 PMlenqnr
07/05/2019, 12:50 PM