I'm Building Taskito
I'm Building Taskito
Get it on Google Play Download on the App Store

EventBus Demo

I have started working on a new application and for this I was looking for ways to communicate between Service and Activity. I found out about EventBus. Eventbus is really easy to use and can be used to communicate between any Objects. EventBus communication happens by posting parcelable classes around. I will not beat around the bush much and jump in the vague details.


To try out EventBus, I made a small demo application. Activity sends data to a background service using EventBus. The service running in background process the data sends the result to the Activity. This turned out to be very easy.

Notes about EventBus

Before I bagan, I jotted down few important things about EventBus.

  • If you want to receive some event, you need to register your class with EventBus.
  • If you have registered your class with EventBus, you must have a method public void onEvent(SomeEventType event) where SomeEventType is what you are expecting.
  • Unregister your class when not required.


Get text from EditText and send to Service.


Process incoming data and send result to Activity

This was fairly easy. You can get demo application source here. EventBusDemo

P.S. A lot of new things to learn ahead.

Playing around with Android UI

Articles focusing on Android UI - playing around with ViewPagers, CoordinatorLayout, meaningful motions and animations, implementing difficult customized views, etc.

Read next