开发者

An EventBus framework for Android [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possi开发者_如何学运维bly reopened, visit the help center for guidance. Closed 10 years ago.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜