RxJava; How to emit observables synchronously
<p>I want to synchronously emit two Observable objects (which are asynchronous), one after the other where it returns the <em>first</em> emitted Observable object. If the first one fails, it should not emit the second one.</p>

<p>Let's say we have one Observable that signs a user in, and another Observable that automatically selects the user's account, <em>after</em> signing in. </p>

<p>This is what I tried:</p>

<pre><code>public Observable&lt;AccessToken&gt; signInAndSelectAccount(String username, String password)
{

    Observable&lt;AccessToken&gt; ob1 = ...; // Sign in.
    Observable&lt;Account&gt; ob2 = ...; // Select account.


    return Observable.zip(
            ob1,
            ob2,
            new Func2&lt;AccessToken, Account, AccessToken&gt;() {
                @Override
                public AccessToken call(AccessToken accessToken, Account account)
                {
                     return accessToken;
                }
            });
}
</code></pre>

<p>This unfortunately does not work for my use case. It will emit/call both observables parallel, starting with 'ob1'.</p>

<p>Did someone encounter a similar use case? Or has an idea on how to make observables wait for eachother in a synchronous way, where the first emitted can be returned?</p>

<p>Thanks in advance.</p>