当前位置:   article > 正文

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

mainactivity and its super classes have no public methods with the @subscrib

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

这是我的BaseFragment部分代码:

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


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


声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号