Android为TV端助力:EventBus跨进程发送消息

单一app内的用法

如果你在单一app内进行多进程开发,那么只需要做以下三步:

Step 1

在gradle文件中加入下面的依赖:

  1.  
    dependencies {
  2.  
    compile 'xiaofei.library:hermes-eventbus:0.1.1'
  3.  
    }

Step 2

在Application的onCreate中加上以下语句进行初始化:

HermesEventBus.getDefault().init(this);

Step 3

每次使用EventBus的时候,用HermesEventBus代替EventBus。

  1.  
    HermesEventBus.getDefault().register(this);
  2.  
    HermesEventBus.getDefault().post(new Event())
原文地址:https://www.cnblogs.com/xiaoxiaing/p/9356061.html