Greenrobot EventBus event not received
You probably need to use sticky events in this case. After Activity1 starts Activity2 it goes to the background, and can no longer receive any events.
Put this in your Activity1 instead of EventBus.getDefault().register(Object Event)
@Override
public void onStart() {
super.onStart();
EventBus.getDefault().registerSticky(this);
}
and replace
EventBus.getDefault().post(new MyEvent());
in Activity2 with
EventBus.getDefault().postSticky(new MyEvent());
Here is a link to the documentation explaining it
How does your Activity1 EventBus unregister look like?
I had the same issue because of I was doing this:
Activity1.java
@Override
protected void onStop() {
super.onStop()
EventBus.getDefault().unregister(this);
}
The problem with this is that when you start Activity2 onStop
gets call, therefore removing the subscription to the event. I was able to solve that by moving the unregister to onDestroy so:
Activity1.java
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}