4

AndroidでGreenロボットイベントバスを使用しています

EventBus.getDefault().post と onStop を使用してすべてのイベントを呼び出しています。 EventBus.getDefault().unregister(this); を呼び出しています。私のアクティビティで。ただし、押し戻してアプリケーションを再度開くと、1 つのイベント投稿で複数の onEvent() が受信されます。他の誰かがこの問題に直面しましたか?

@Override
protected void onStart() {
    super.onStart();
    getBus().register(this);
}

@Override
protected void onPause() {
    getBus().unregister(this);
    super.onPause();
}

@Override
protected void onStop() {
    getBus().unregister(this);
    super.onStop();
}


protected EventBus getBus() {
    return EventBus.getDefault();
}
4

1 に答える 1