title: RxJava, execute code in the observer thread before chaining two observables
body: <p>I'm using RxJava and RxAndroid, and I want to combine two observables but in between I need to update the UI, so I must execute code in the main thread before <em>reaching</em> the subscriber.</p>
  
  <p>One solution, instead of flatmapping (is that an accepted term?) two observables, would be to call the next observable in the subscriber just after updating the UI, but I feel that there should be a more elegant solution like:</p>
  
  <pre><code>myObservable
      .map(new Func1&lt;Object, Object&gt;() {
          @Override
          public Object call(Object object) {
              /* do stuff on the main thread */
              return object;
          }
      })
      .flatMap(new Func1&lt;Object, Observable&lt;OtherObject&gt;&gt;() {
          @Override
          public Observable&lt;OtherObject&gt; call(Object o) {
              return new MyOtherObservable(o);
          }
      })
      .subscribeOn(Schedulers.newThread())
      .observeOn(AndroidSchedulers.mainThread());
  </code></pre>
  
  <p>Of course, probably map is not the operator I need to use here. So, is there an operator or a better way to achieve this? Or am I missing the point about how observables should work?</p>