otto ライブラリを使用して、イベントのサブスクライブに FragmentDialog を使用しています。
@Subscribe
public void onPickupRequestResponse (PassengerPickupRequestResponseEvent event){
Toast.makeText(this.getActivity().getApplicationContext(), "Event handled", Toast.LENGTH_SHORT).show();
dismiss();
}
FragmentDialog を OnResume イベントに登録し、onPause メソッドで登録解除します。
@Override
public void onResume() {
super.onResume();
App.bus.register(this);
}
@Override
public void onPause() {
super.onPause();
App.bus.unregister(this);
}
次に、アクティビティでイベントを投稿します
App.bus.post(new PassengerPickupRequestResponseEvent());
しかし、私の FragmentDialog はこのイベントを処理しません。