0

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?

hungps
  • 389
  • 2
  • 11
  • Possible duplicate of [Rxjava Android how to use the Zip operator](https://stackoverflow.com/questions/30219877/rxjava-android-how-to-use-the-zip-operator) – Santanu Sur May 12 '18 at 18:56

1 Answers1

2

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()
Serg Burlaka
  • 2,351
  • 24
  • 35