Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RuntimeException: Could not dispatch event @ otto

we have an issue in our current app-version with the EventHandler from otto. We get a RuntimeException in our crash-log, with following description:

"Reason: java.lang.RuntimeException: Could not dispatch event: classcom.nameOfBrand.ui.events.SwitchFragmentEvent to handler [EventHandler public void com.nameOfBrand.ui.activities.MainActivity.onSwitchFragmentEvent(com.nameOfBrand.ui.events.SwitchFragmentEvent)]"

We have a button and in its onClickListener we fire an self-defined SwitchFragmentEvent. In some weird situations, the framework can't dispatch the Event and throws an RuntimeException.

The fragment with the button extends AbstractResultListFragment and this one extends AbstractFragment. We register the EventBus in the onResume of AbstractFragement and unregister it at onPause. Everything works fine, except at this one button :/

Does anyone have an idea or had ever to do with something like this?

UPDATE: Scompt was right. The RuntimeException was thrown from otto cause of a NullPointerException in our code. Thx

Tipp: Read your crash-logs until the end ;)

like image 335
iFoukis Avatar asked Jun 13 '14 10:06

iFoukis


2 Answers

There should be a wrapped exception at that point that will provide more information about the crash.

like image 117
Edward Dale Avatar answered Sep 28 '22 00:09

Edward Dale


If you use with AndroidAnnotation, add @UiThread to view treatment method. Note that the method should not be private.

like image 27
Youngjae Avatar answered Sep 28 '22 00:09

Youngjae