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.
You can give guava EventBus a try - it seems to work fine and has a very clean interface.
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.
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.
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
精彩评论