1

I have a problem into subscriber at this post and I solve that. my subscriber was a fragment. But now my subscriber is a simple class.Is it possible ?

Because I got this error:

org.greenrobot.eventbus.EventBusException: Subscriber class com.safa.musers.MainActivity and its super classes have no public methods with the @Subscribe annotation

I am using in this way:

public class Paginator {

EventBus bus = EventBus.getDefault();
private Context ctx;
private String securitySrv;
private int totalItems;
private ExecutorService executorService;
private Cookie cookie;

public Paginator(Context ctx) {
    this.ctx = ctx;
    bus.register(ctx);
}

And finally for receive post:

    @Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEvent(UserEvent event) {
    securitySrv = event.getSecuritySrv();
    cookie = event.getCookie();
    totalItems = event.getTotalUsersSecurity();
    executorService = event.getExecutorService();
}

But I got above Error.thank you for helping

My MainActivity is not subscribe an event or post an event.

Cyrus the Great
  • 5,145
  • 5
  • 68
  • 149

0 Answers0