MainActivity and its super classes have no public methods with the @Subscribe annotation

来源:互联网 发布:乐拼积木 淘宝 编辑:程序博客网 时间:2024/06/05 09:04

这个问题的答案恐怕一般都是在某个响应方法上加@Subscribe注解,我看了一百遍还是加了,还是没解决问题,后来终于机缘巧合下被我发现了事情的真相大笑

这是我的BaseFragment部分代码:

    @Nullable    @Override    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {        view = View.inflate(getContext(), getContentViewLayoutId(), null);        unbinder = ButterKnife.bind(this, view);        initViewsAndEvents();        return view;    }
   protected abstract int getContentViewLayoutId();   protected abstract void initViewsAndEvents();

我错在不小心把register方法写在getContentViewLayoutId()方法中了,应该写在initViewAndEvents()方法中,以后我可千万注意不在getContentViewLayoutId方法中乱写了。


阅读全文
0 0
原创粉丝点击