Search code examples
androidotto

Otto event no firing


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");

Solution

  • Found the answer thanks to these guys.... AndroidAnnotations was overriding @subscribe, so my subsrcibed event was never getting fired, found this by using break points.... Too bad, I moved to EventBus and everything is working fine.... Such a pitty I loved otto so much.....