1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > EventBus报错:and its super classes have no public methods with the @Subscribe annotation

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

时间:2021-03-23 03:19:08

相关推荐

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

繁忙的工期终于结束了,今天封装了工作相关的内容。在处理一个观测者模式的时候想想用用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的

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。