Question

I'm trying to pass String value between fragments using Otto. It seems like @Produce and .post works well. But @Subscribe isn't Working... I've registered BusProvider on Both Fragments. But it isn't working. What should i do to make it work?

AppDrawerFragment.java https://gist.github.com/sukso96100/a636a7ead69839cfa5b6

WorkspaceFragment.java https://gist.github.com/sukso96100/5f4fc8d3f74997d830c1

BusProvider.java https://gist.github.com/sukso96100/733118a4c03bc5fc5d5f

AddAppShortcutToHomeEvent.java https://gist.github.com/sukso96100/a6c09f27ec6264d5d9c4

Was it helpful?

Solution

You want to do

BusProvider.getInstance().register(this);

instead of

BusProvider.getInstance().register(getActivity());

to correctly register for receiving events.

And to unregister you simply do

BusProvider.getInstance().unregister(this);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top