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的

你可能感兴趣的:(android,错误)