https://kotlinlang.org logo
Title
i

iex

01/20/2020, 9:29 PM
how do I convert
MutableLiveData
to
Observable
?
a

Andrew

01/20/2020, 9:45 PM
What is the use case for this? Technically there is not a 100% accurate way to do this conversion since livedata sends its updates to lifecycleowners which observable is not. A lifecycle owner could update the observable based on the livedata changes as a sort of workaround to this but I can't think of a case where this would be needed.
i

iex

01/20/2020, 10:04 PM
someone configured validation inputs in view model as live data, e.g. email, name, password...
each has a live data, which is wired to the UI via data binding...
now I want to process / validate these inputs, but this is kinda business logic so I want to do it with rx
thus I need live data -> rx conversion
I guess I can change the live data inputs if needed to something else, not sure what
a

Andrew

01/20/2020, 10:12 PM
i

iex

01/21/2020, 7:15 AM
medium... can't read, article limit 🙂
g

gsala

01/21/2020, 7:54 AM
a

aoriani

01/21/2020, 9:11 AM
@iex Just use incognito
i

iex

01/21/2020, 9:38 AM
@aoriani oh lol, I opened it in a different browser, thinking that it would react to the missing cookies but it didn't work? incognito works
thanks
ok, I checked it out, but I really would like to use rx and not live data to perform the validation. Have a bit more complex flow in mind and it becomes very unwieldy with live data
c

Christophe Smet

01/21/2020, 10:40 AM
The conversion between the two is not optimal. I had problems with livedata being subscribed for ever. You could subscribe to a livedata en then emit it in a publisher perhaps ? But that all sounds pretty bad
i

iex

01/21/2020, 3:36 PM
so should I just ditch live data for inputs?
and leave it for view model -> ui only?