相关疑难解决方法(0)

Android中的greenrobot EventBus发布活动

通过使用EventBus,我需要在Activity中发布一个事件(MyEvent)并在Android中的另一个Activity中接收该事件.我尝试了greenrobot EventBus性能测试项目,但无法做到这一点.

我在ActivitySubscriber中尝试过

MyEvent event = new MyEvent();
EventBus.getDefault().post(event);
Run Code Online (Sandbox Code Playgroud)

并试图在接收事件ActivityReceiver

EventBus.getDefault().register(this);

public void onEvent(MyEvent event){
....
}
Run Code Online (Sandbox Code Playgroud)

但是我无法收到这个活动.任何人都可以让我知道我在哪里做错了吗?

android event-bus

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1

event-bus ×1