eventbus线程间轻量级传递消息的使用

来源:互联网 发布:锐科特思网络 编辑:程序博客网 时间:2024/05/29 13:12

一。依赖

compile 'org.greenrobot:eventbus:3.0.0'
二。发送消息

EventBus.getDefault().post(new AnyEventType event);  
三。接收消息

注册

EventBus.getDefault().register(this);
解除注册

EventBus.getDefault().unregister(this);
接收消息

  1. public void onEvent(AnyEventType event) {}  

阅读全文
0 0