在服务中,我发布了事件,并在我的activity
中收到了两个我尝试这样做的相同事件:
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public synchronized void onEvent(EventAddNoteAndRealize event) {
if (eventAddNoteAndRealize == null) {
this.eventAddNoteAndRealize = event;
getRealizeAndNote(event);
} else if (event != null && event != eventAddNoteAndRealize) {
this.eventAddNoteAndRealize = event;
getRealizeAndNote(event);
}
}
但我总是有eventAddNoteAndRealize
null
在服务中,我像这样发布此evet:
EventBus.getDefault().post(new EventAddNoteAndRealize(noteAndRealizeDAOs));