-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Combine(zip) 2 or more API calls in LiveData #40
Comments
I don't have code yet but I think you can still achieve the same by using LiveData fromPublisher (Publisher publisher). In this case publisher being flowable.zip() |
Thanks NkoroiEric
I can't find LiveDataReactiveStreams and Publisher class , could you
provide any sample or detailed documentation is helpful for me.
https://developer.android.com/reference/android/arch/lifecycle/LiveDataReactiveStreams.html#fromPublisher(org.reactivestreams.Publisher
<T>)
…On Thu, Jun 1, 2017 at 4:23 PM, NkoroiEric ***@***.***> wrote:
I don't have code yet but I think you can still achieve the same by using
LiveData fromPublisher (Publisher publisher). In this case publisher being
flowable.zip()
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#40 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGcSnY-XM6j0Bjt4SbTDu0SuM7D09jArks5r_pg6gaJpZM4NshUD>
.
--
S.Saravanan || +919688851518
|
Hi! |
We don't provide these methods because we don't want live data to grow into the complexity of RxJava. That is why we provide the reactivestreams API for RxJava people. Alternatively, you can implement this yourself using the |
I have add , |
Hi man checkout this link for an explanation https://developer.android.com/topic/libraries/architecture/adding-components.html or you can simply add |
@yigit I agree with you. I think more complex transformations can be added in the |
@yigit , I was trying your method MediatorLiveData ,it only handle same return type of LiveData not different type LiveData. I tried a lot , but didn't find correct approach to combine the call's using MediatorLiveData and Transfermations. |
Here's the Kotlin code I used to implement my |
I had the same needs and at the end I solved with a Kotlin extension that allows me to concatenate livedata results as I did with promises. I created a gist with my solution https://gist.github.com/ch4vi/0f7893bd830f195a99881a30b3cb7640 |
Create class that contains child and parent room Entity from: https://developer.android.com/reference/androidx/room/Transaction
|
In Reactive java we use observable.zip() for combine n numbers of API call or methods result into one .
In LiveData , How we achive this , Any sample code is avilable ?
The text was updated successfully, but these errors were encountered: