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