greenrobot / EventBus

Event bus for Android and Java that simplifies communication between Activities, Fragments, Threads, Services, etc. Less code, better quality.
http://greenrobot.org/eventbus/
Apache License 2.0
24.67k stars 4.66k forks source link

Subscriber class java.lang.Class has no public methods called onEvent #153

Closed xiaojidonggong closed 9 years ago

xiaojidonggong commented 9 years ago

my BaseActivity onCreate write this: EventBus.getDefault().register(this);

And some SubActivity regist ,and some not , my business , when Push info coming, whatever current Activity is , show a dialog ,notify the users.

greenrobot commented 9 years ago

This is a bug tracker, not a user forum. Please check the docs and stackoverflow if you need further assistance.

ppamorim commented 9 years ago

@tikkat3, simply add "onEventMainThread" with the same "onEvent" params. Worked here. @greenrobot, why you not create the "Question" label. Don't use labels seems something as beginner... Sorry.

greenrobot commented 9 years ago

@ppamorim Can you point me to a GitHub project to see how they handle it in a better way? Sometimes we use the "invalid" tag for those kind of "issues", see https://github.com/greenrobot/EventBus/issues?q=is%3Aissue+label%3Ainvalid+is%3Aclosed, but sometimes I forget to label.

ppamorim commented 9 years ago

@greenrobot https://github.com/pedrovgs/DraggablePanel/issues

greenrobot commented 9 years ago

Thanks. I keep using the "invalid" tag, because I don't want to handle support requests here.

ppamorim commented 9 years ago

@greenrobot ok

akilaselvi commented 7 years ago

de.greenrobot.event.EventBusException: Subscriber class com.payUMoney.sdk.SdkHomeActivityNew has no public methods called onEvent at de.greenrobot.event.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:99)

i got error at this line...can you please tell whats going wrong here??? if (EventBus.getDefault() != null && !EventBus.getDefault().isRegistered(this)) { try { EventBus.getDefault().register(this); }catch (EventBusException e){ e.printStackTrace(); Log.e("Exce","e",e); } }

greenrobot-team commented 7 years ago

@akilaselvi Assuming you are using EventBus 2: make sure you have added an event handling method. It must be named "onEvent", be public, return nothing (void), and have exactly one parameter (the event).

Or update to EventBus 3 and use annotations. -ut