Eventbus个人记录

//指令数据类
1.接收数据
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
public void messageEventBus1(ZlBeanMess bean) {
    if (bean != null) {
      
    }
}

2.注册

EventBus.getDefault().register(this);

3.销毁粘性

MessageEvent stickyEvent = EventBus.getDefault().getStickyEvent(ZlBeanMess.class);
if (stickyEvent != null) {
    EventBus.getDefault().removeStickyEvent(stickyEvent);
}

4.发送

EventBus.getDefault().postSticky(new MeaageXX(ZlBeanMess ));

 

你可能感兴趣的:(Eventbus个人记录)