I have an activity and it launches a DialogFragment, on completion of an event the DialogFragment posts an event on the Otto Event Bus, this is to fire a method in it's parent activity. I've posted the related code here, the same code is working else where in my app, but here the event is just no firing.
Code in the activity...
@Subscribe
public void OttoUpdateUI(BudgetUpdateObject budgetUpdateObject)
{
updateUI();
Log.d("budget", "Otto updateUI called");
}
@Override
public void onResume() {
super.onResume();
BusStand.getInstance().register(BudgetActivityNew.class);
}
@Override
public void onPause() {
super.onPause();
BusStand.getInstance().unregister(BudgetActivityNew.class);
}
BusStand class....
public final class BusStand {
private static final Bus BUS = new Bus();
public static Bus getInstance() {
return BUS;
}
private void BusProvider() {
}
}
and the firing event...
BusStand.getInstance().post(new BudgetUpdateObject());
I've checked the import in the activity, and I'm not using dagger module, and i'm not using any other event bus. Any help will be much appreciated.
This is the way I launch the DialogFragment from the activity....
AddBudgetDialogFragment addBudgetDialogFragment = new AddBudgetDialogFragment();
addBudgetDialogFragment.setStyle(DialogFragment.STYLE_NO_TITLE,0);
addBudgetDialogFragment.show(getSupportFragmentManager(),"DialogFragment");
pause
the activity on doing this? If the Activity is paused the event is arriving beforeonResume
is called – Albaalbacete