https://kotlinlang.org logo
#android
Title
# android
s

Slackbot

07/12/2022, 7:20 AM
This message was deleted.
f

Frank van der Laan

07/12/2022, 9:52 AM
this is code from 2 classes merged here into one code block?
"nothing will change", maybe connect your debugger and see what part of the code is not reached.
t

Tong Zhang

07/12/2022, 9:55 AM
yes ,merged core code from a
ViewModel
and an
Activity
I just don't understand why I can't receive the content sent by
stateFlow
when I rotate the screen and then click the button.
f

Frank van der Laan

07/12/2022, 2:48 PM
I don't see anything strange here. Are you sure only one VM is created?
g

Gibson Ruitiari

07/14/2022, 8:58 PM
maybe try to remove the withContext(Dispatchers.Main) block, by default repeatOnLifecycle does its work on the main Dispatcher so I don't think it is needed
2 Views