例:
创建Module,关联EventBus框架,创建第2个Activity
完成Module的布局及控件的初始化
创建EventBus消息类,设置属性
使用EventBus的postSticky方法发送黏性事件
根据消息类,接收黏性事件(注意:注解要添加sticky = true)
注册EventBus,解除EventBus黏性事件及注册
加依赖:
dependencies { compile 'org.greenrobot:eventbus:3.0.0' }
加权限:
MainActivity 主要:
/** * 创建Module,关联EventBus框架,创建第2个Activity 完成Module的布局及控件的初始化 创建EventBus消息类,设置属性 使用EventBus的postSticky方法发送黏性事件 根据消息类,接收黏性事件(注意:注解要添加sticky = true) 注册EventBus,解除EventBus黏性事件及注册 */