我在this post的订阅者身上遇到了问题,我解决了这个问题。我的订阅者是一个片段。 但现在我的订阅者是一个简单的类。这可能吗?
因为我收到了这个错误:
org.greenrobot.eventbus.EventBusException: Subscriber class com.safa.musers.MainActivity and its super classes have no public methods with the @Subscribe annotation
我正在以这种方式使用:
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);
}
最后收到帖子:
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEvent(UserEvent event) {
securitySrv = event.getSecuritySrv();
cookie = event.getCookie();
totalItems = event.getTotalUsersSecurity();
executorService = event.getExecutorService();
}
但我得到了Error.thank你帮助
我的MainActivity不订阅活动或发布活动。