1

I am using an event bus (greenrobot) for communication between fragments and activities. Works great.

But one thing I was wondering about: How do people keep track of where these are fired?

Example: When I see an onEvent() method somewhere, how can I find the places where this gets fired?

Jens
  • 6,243
  • 1
  • 49
  • 79

1 Answers1

3

Granted you are using IntelliJ Idea/Android Studio, and the method is onEvent*(E ...):

  • Ctrl + click on E will move you to E class file
  • Ctrl + click again on E class (as in e.g. public classE) will show you all the usages of E class in general. You may want to filter out import statements in the show pop out dialog by clicking on the italized, blue i icon.

Bonus: If the event class has only one constructor, it's better to ctrl + click it instead of class name. This will show you places where the event object is created.

wfranczyk
  • 420
  • 3
  • 12
  • 1
    Problem (for me) is that my `onEvent(E...)` methods do not always follow the principle that `E...` is the source for the `post`. I do have Fragments that fire an event and pass just a data object as the parameter... In these cases this does not work... – Jens Dec 10 '15 at 13:44