您的位置:首页 > 其它

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

2017-11-22 10:28 330 查看
一。依赖

compile 'org.greenrobot:eventbus:3.0.0'

二。发送消息

EventBus.getDefault().post(new AnyEventType event);  

三。接收消息

注册

EventBus.getDefault().register(this);

解除注册

EventBus.getDefault().unregister(this);

接收消息

public void onEvent(AnyEventType event) {}  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: