2014-07-24 15 views
5

同時使用綠色機器人Eventbus我得到一個錯誤Subscriber類沒有公有方法呼籲事件

E/AndroidRuntime(2537): Caused by: de.greenrobot.event.EventBusException: Subscriber class com.example.MyActivity has no public methods called onEvent 

詳情:

我加載它包含一個片段與10個片段的活動,而不是在每個嵌套(子)片段中調用EventBus.getDefault().register(this);,我在該片段的父活動中調用register

回答

5

通過聲明onEventMainThread方法和EventBus.getDefault().register(this);在同一片段(應相同的類聲明)

0

聲明的onEventMainThread方法解決:

@Subscribe 
public void onEventMainThread(OTPEvent event) { 

} 
相關問題