I am a bit confused about using onEvent , onEventMainThread , onEventBackgroundThread and onEventAsync in Greenrobot EventBus 3.0
From what I see in the documentation :
onEvent used with ThreadMode.POSTING (default)onEventMainThread used with ThreadMode.MAINonEventBackgroundThread used with ThreadMode.BackgroundThreadonEventAsync used with ThreadMode.ASYNC
But in case the event is sent from the background thread:
@Subscribe(threadMode = ThreadMode.MAIN) public void onEventMainThread(MyEvent event) {
has the same behavior as:
@Subscribe(threadMode = ThreadMode.MAIN) public void onEvent(MyEvent event) {
and
@Subscribe public void onEventMainThread(MyEvent event) {
Throws CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. , because the stream is the same as the wiring stream (the background stream in my tests).
Starting with version 3.0, the @Subscribe annotation is @Subscribe , so I donβt understand in which case I should use methods other than onEvent . Have they been saved to upgrade from EventBus 2 to 3?
grim
source share