Skip to content
This repository has been archived by the owner on Apr 30, 2019. It is now read-only.

Update docs for best place to register the bus #176

Open
philippeluickx opened this issue Nov 16, 2015 · 2 comments
Open

Update docs for best place to register the bus #176

philippeluickx opened this issue Nov 16, 2015 · 2 comments

Comments

@philippeluickx
Copy link

Based on http://stackoverflow.com/questions/19692711/illegalargumentexception-with-otto-event-bus-in-fragment-instance/19737191#19737191

I just lost 3 days and a lot of hair because of a usecase where my subscriber did not get an event. I changed my bus registration from onResume/onPause (which is used e.g. at https://github.com/square/otto/blob/master/otto-sample/src/main/java/com/squareup/otto/sample/LocationHistoryFragment.java#L33) to onStart/onStop and everything works.

@felipecaldas
Copy link

Didn't work for me. I had it first onReume and now at onStart. I dont get the message in my Subscribe method.

@jemshit
Copy link

jemshit commented Mar 21, 2016

In Fragments , registering/unregistering on onResume() and onPause() works good for me. Now i'm having trouble in DialogFragment which this didn't work. So i register/unregister on onAttach() and onDetach(). Found thread about this: http://stackoverflow.com/questions/32165006/otto-event-no-firing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants