Tutorial :An EventBus framework for Android [closed]



Question:

Can anybody recommend a good framework for handling events in Android? These would be business logic events like UserUpdatedEvent. I am looking for something similar to the EventBus provided by GWT-EVENT but for a JVM that supports weak-references.


Solution:1

I'm not sure an event bus makes as much sense in Android. It's useful in GWT, because the UI's can become very complex. In Android, they have to be very simple because resources and screen real estate is very limited. However, if you really need one, it should be relatively simple to write your own. It's essentially just the observer pattern.


Solution:2

You can give guava EventBus a try - it seems to work fine and has a very clean interface.


Solution:3

I used the built in IntentService class to handle events. It processes requests asynchronously off the main UI thread, by way of intent requests. Each intent is added to the IntentService’s queue and handled sequentially.

A decent getting started tutorial for IntentService is available at mobiletuts.


Solution:4

You can use RoboGuice with its EventManager. It is really nice library. I used it in a project and afaik it is simliar to the one included in GWT. Works very nice with Annotations: http://code.google.com/p/roboguice/wiki/Events


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »