Skip to content

Instantly share code, notes, and snippets.

@kaushikgopal
Created June 26, 2016 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaushikgopal/683d9fd1b307ff4ce4500e721188bafc to your computer and use it in GitHub Desktop.
Save kaushikgopal/683d9fd1b307ff4ce4500e721188bafc to your computer and use it in GitHub Desktop.
Blog post snippet for implementing event bus
// note that it is important to subscribe to the exact same _rxBus instance that was used to post the events
_rxBus.toObserverable()
.subscribe(new Action1<Object>() {
@Override
public void call(Object event) {
if(event instanceof TapEvent) {
_showTapText();
}else if(event instanceof SomeOtherEvent) {
_doSomethingElse();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment