I read documentation here but there is no clear explanation will event trigger if configChanges occur in activity or if activity in background with EventBus.getDefault().post()
. Now I'm using EventBus like this:
EventBus.getDefault.postSticky(new SomeEvent());
public void onEventMainThread(SomeEvent someEvent){
EventBus.getDefault().removeStickyEvent(someEvent);
}
I would like to avoid this boilerplate code.
The
Activity
will obviously not receive any events betweenunregister()
inonDestroy()
andregister()
inonCreate()
- remember that by default theActivity
will be fully recreated when configuration changes. However, if youregisterSticky()
then you'll have access to the latest published event, even if it arrived at the moment ofActivity
recreation.