title: RxJava chain requests and update UI
body: <p>I want to chain up three network calls with <code>RxJava</code>and <code>Retrofit</code>. The first call (retrieves the session token) has to be the first, the other two depend on this call and if the first call isn't finished before, the other two calls will result in an error. </p>
  
  <p>For the other two calls, they should retrieve some information and update the UI. What would be the best way to proceed? 
  I first thought about using the <code>zip Operator</code>, but I'm not sure if it respects the order of the requests and as it returns a value, it felt like abusing it to just use it to bundle up the requests without any further processing.</p>
  
  <p>My second approach would be to flatmap the requests and use doOnNext to update the UI once, but I'm not certain if this is the correct way.</p>
  
  <pre><code>private void setUpInitialUIState() {
          restClient.requestSessionToken()
                  .subscribeOn(Schedulers.io())
                  .unsubscribeOn(Schedulers.io())
                  .observeOn(AndroidSchedulers.mainThread());
                  .flatMap(new Func1&lt;SessionTokenResponse, Observable&lt;CurrentPlmnResponse&gt;&gt;() {
                      @Override
                      public Observable&lt;CurrentPlmnResponse&gt; call(SessionTokenResponse sessionTokenResponse) {
                          return restClient.requestCurrentPlmn();
                      }
                  })
                  .doOnNext(new Action1&lt;CurrentPlmnResponse&gt;() {
                      @Override
                      public void call(CurrentPlmnResponse currentPlmnResponse) {
                          if (!currentPlmnResponse.isError()) {
                              tvProvider.setText(currentPlmnResponse.getData().getFullName());
                          }
                      }
                  })
                  .flatMap(new Func1&lt;CurrentPlmnResponse, Observable&lt;MonitoringStatusResponse&gt;&gt;() {
                      @Override
                      public Observable&lt;MonitoringStatusResponse&gt; call(CurrentPlmnResponse currentPlmnResponse) {
                          return restClient.requestMonitoringStatus();
                      }
                  })
                  .subscribe(new Subscriber&lt;MonitoringStatusResponse&gt;() {
                      @Override
                      public void onCompleted() {
                      }
  
                      @Override
                      public void onError(Throwable throwable) {
                       Log.d("onError", throwable.toString());
                      }
  
                      @Override
                      public void onNext(MonitoringStatusResponse monitoringStatusResponse) {
                          if (monitoringStatusResponse != null &amp;&amp; !monitoringStatusResponse.isError() &amp;&amp; monitoringStatusResponse.getData().getSignalIcon() &gt;= 0 &amp;&amp; monitoringStatusResponse.getData().getSignalIcon() &lt;= 5) {
                              ivSignalStrength.setImageResource(getResources().getIdentifier("ic_signal_" + monitoringStatusResponse.getData().getSignalIcon(), "drawable", getPackageName()));
                              tvNetworkType.setText(getNetworkTypeTitle(monitoringStatusResponse.getData().getCurrentNetworkType()));
                          }
  
                      }
                  });
      }
  </code></pre>