Android为TV端助力 EventBus出现has no public methods called onEvent的问题

Caused by: de.greenrobot.event.EventBusException: Subscriber class com.hhzt.iptv.lvb_w.socket.MyMsgService has no public methods called onEventsocket

 

 

出现上述的问题缘由就是你在当前类中去注册EventBus.getDefault().register(this),可是你并无在当前类中写任何关于onEvent开头的公共的方法,因此报错post

意思就是,若是你要在哪一个类中接收EventBus消息,那你才去注册EventBus.getDefault().register(this),而且复写一个onEvent开头的公共的方法,若是你仅仅是this

单纯的发送消息EventBus.getDefault().post(bean); 是不须要注册的,我以前报错就是误觉得,发送消息也要注册,因此。。。blog

另外需求注意的是EventBus.getDefault().post(bean)发送消息给activity,若是当前的接收消息的activity不处于前台任务栈,那么是没法收到消息的ip

相关文章
相关标签/搜索