Reputation: 389
Say that I have 5 observables, all of them are retrofit api call (one is for login)
Now i want to login, after that run all 4 other observables at the same time when the login progress has been finished.
Is there anyway I can do it?
Upvotes: 0
Views: 124
Reputation: 2496
Here code sample using rx
on Kotlin
login()//need return Observable
.flatMap{ result->
//maby init calls observables
zip(firstCallObservable, secondObservable, thirdCallObservanle,fouthCallObservable){
first, second, third, fouth->
//do something with data
}}
.subscribeOn(Schedulers.io())
.observOn(AndroidSchedulers.mainThread())
.subscribe()
Upvotes: 2