HI Guys, I have Main fragment which consists of tw...
# android
t
HI Guys, I have Main fragment which consists of two buttons, on first button I invoke dailog fragment. using viewModelScope.launch in to fetch details and update UI my dialog fragment .
viewModelScope.launch
 works perfectly fine when hit for the first time on button click, but does not work for the second time [means when i close my dialog fragment and click back the same button again ]. can you please suggest me how to resolve this issue ??
r
There’s not really enough information to help you. It’s hard to tell what you mean when you say “does not work for the second time”. Does that mean your app crashes? Does that mean that you’re not getting the expected functionality? If it’s the former, a stacktrace would let you know what’s going wrong. If it’s the latter, we’d need more information about
startScheduler
. With what you’ve provided here, everything should function correctly in terms of pure execution.