문제

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

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top