I have a case where I'm using `BehaviorRelays` wit...
# android-architecture
m
I have a case where I'm using
BehaviorRelays
with viewModel, the problem is in case of the device rotation,
ViewModel
subscribe again which cause duplicate subscription with each rotation. I know I could save a subscription with
Disposable
and dispose it if it exists, then subscribe .. but is there any other cleaner solution.
s
u
you should not subscribe again on rotation, thats the whole point of viewmodel retaining
✔️ 1
m
@ursus yes but how you observe ui, the whole ui is recreate with the life cycle, you must to bind subscriptions again.
u
sideffect to behavior relays,and expose them to the ui
m
that's when you need to update UI, but how to Observe user interactions, like clicks, updating texts
u
oh yea sorry, I use regular functions like viewModel.userClick()