当前位置:   article > 正文

EventBus3.0报 Subscriber class ...... already registered to......_already registered to event class

already registered to event class

问题描述:

fragment的 onCreateView()里面注册eventbus

EventBus.getDefault().register(this);
运行的时候报错如下:

org.greenrobot.eventbus.EventBusException: Subscriber class ... already registered to event class ...


分析:

报错的意思是:消息接收类已经注册过了


解决:注册前先判断

if(!EventBus.getDefault().isRegistered(this)){
 
    EventBus.
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/251168
推荐阅读
相关标签
  

闽ICP备14008679号