4
A
回答
3
使用http://square.github.io/otto/进行事件监听。
这是使用的例子:
Bus bus = new Bus();
bus.post(new AnswerAvailableEvent(42));
@Subscribe public void answerAvailable(AnswerAvailableEvent event) {
// TODO: React to the event somehow!
}
bus.register(this); // In order to receive events, a class instance needs to register with the bus.
+0
Thankyou为这个答案,作品像一个魅力。 – Max
相关问题
- 1. 设置自定义事件侦听器
- 2. 自定义ExceptionMappingInterceptor不侦听
- 3. 如何设置侦听器?
- 4. Spring JMS侦听器容器侦听器安装程序超时
- 5. 在Android中为整个应用程序设置当前位置侦听器?
- 6. ListView项目的自定义侦听器
- 7. 自定义侦听器为空
- 8. TypeScript自定义事件侦听器
- 9. React自定义事件侦听器
- 10. 自定义msmq跟踪侦听器
- 11. 如何删除自定义侦听器?
- 12. 自定义事件侦听器。EventEmitter
- 13. 触摸侦听器侦听边距
- 14. 在系统应用程序上设置动作侦听器
- 15. 将按键侦听器设置为自定义视图
- 16. LocationManager.removeUpdates(侦听器)不删除位置侦听器
- 17. 设置超时GPS侦听
- 18. Symfony2自定义事件调度程序和侦听器
- 19. 两个侦听
- 20. 停止位置侦听器
- 21. Android:位置侦听器
- 22. 在Angular应用程序中侦听socket.io
- 23. Android应用上的自定义事件侦听器
- 24. 如何设置SimpleAdapter的侦听器
- 25. XMPP无法设置侦听器
- 26. 哪种设置侦听器更好?
- 27. Android:如何设置Acivity.onNewIntent()的侦听器?
- 28. Lua Corona - 如何在滑动过程中侦听widget.newScrollView侦听器
- 29. 扩展ActionEvent?自定义事件,没有自定义侦听器?
- 30. Infinispan CacheEntryExpired侦听器
看看到奥托或greenrobot事件总线,这是最有可能为你 –
感谢尖端的解决方案,将看看这个! – Max
我对EventBus也有非常积极的体验,我很乐意推荐它。 – Vucko