1

I'm trying to Subscribe and Post from the same fragment, but I'm getting this error when i try to register the fragment:

...(my method) has @Produce annotation but requires 1 arguments.  Methods must require zero arguments.

on

 BusProvider.getInstance().register(this);

So i guess it's not possible, but maybe there is an alternative without additional interfaces.

Thanks in advance!

Motheus
  • 533
  • 5
  • 21

1 Answers1

4

Methods annotated with @Produce must not take any arguments. They should just return the event object.

"I'm trying to Subscribe and Post" suggests you probably need to change it to @Subscribe annotation instead.

For posting events, just use post(). @Produce is meant for returning the latest value of an event.

laalto
  • 150,114
  • 66
  • 286
  • 303