Skip to content

Instantly share code, notes, and snippets.

@laaptu laaptu/
Last active Aug 29, 2015

What would you like to do?
Making a single class to hold all the Events that would be posted and listened by EventBus
public class Events {
public abstract static class Event {
public String getTag() {
return this.getClass().getSimpleName();
public static class SearchResultEvent extends Event {
public int resultCount;
public SearchResultEvent(int resultCount) {
this.resultCount = resultCount;
public static class SwipeRefreshCancelEvent extends Event {
public boolean enableRefresh;
public SwipeRefreshCancelEvent(boolean enableRefresh) {
this.enableRefresh = enableRefresh;
///Accessing the events like this
public void onEvent(Events.Event event) {
System.out.println("Event received "+event.getTag());
if (event.getTag().equals("SearchResultEvent")) {
} else if (event.getTag().equals("SwipeRefreshCancelEvent")) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.