您的位置:首页 > 其它

EventBus报错:and its super classes have no public methods with the @Subscribe annotation

2017-01-16 10:47 477 查看
繁忙的工期终于结束了,今天封装了工作相关的内容。在处理一个观测者模式的时候想想用用EventBus,于是就用EventBus写了一个栗子但是发现报错了!!!!!看了看报错的内容and its super classes have no public methods with the @Subscribe annotation这句话大概说的意思没有找到公有含有Subscribe注解的方法,也就是说没有找到在EventBus注册Activity中含有Subscribe注解的方法

/**
* EventBus回调的函数
* 第二个传入的参数是自己定义的类
* @param workBean
*/
public void onEventMainThread(WorkBean workBean) {
String msg = "onEventMainThread收到了消息:" +workBean.getTitle();
Log.d("harvic", msg);
tvBusInfo.setText(msg);
}

最后在onEventMainThread中加上@Subscribe就阔以了EventBus还是很6的
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: