Skip to content

Instantly share code, notes, and snippets.

@purplefox
Created March 11, 2013 16:57
Show Gist options
  • Save purplefox/5135685 to your computer and use it in GitHub Desktop.
Save purplefox/5135685 to your computer and use it in GitHub Desktop.
// Clearly this won't actually work since obs2 would need to be final but then you can't assign it inside the handler
MyEventBus eb = new MyEventBus();
Observable obs1 = eb.send("foo", "msg1");
Observable obs2;
obs1.subscribe(new Action1<String>() {
@Override
public void call(String str) {
System.out.println("Got result: " + str);
obs2 = eb.send("foo", str);
}
});
obs2.subscribe(new Action1<String>() {
@Override
public void call(String str) {
System.out.println("Got result: " + str);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment