Skip to content

Observable depends on other Observable | Needing both values #4802

@metp

Description

@metp

I have an Observable whose emitted item I need for the next Observable but I can't use flatMap() because the method I need to call in the Subscriber needs the result of both Observables.

service.getToken(code)
          .subscribe(new Action1<Token>() {
                        @Override
                        public void call(Token token) {
                            service.getProfile(token.getAccessToken())
                                    .subscribe(
                                    new Action1<Profile>() {
                                        @Override
                                        public void call(Profile profile) {
                                            createAccount(token, profile);
                                        }
                                    });
                        }
                    });

Any better approach then this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions