[英]EventBus: How to keep track?
I am using an event bus (greenrobot) for communication between fragments and activities. 我正在使用事件总线 (greenrobot)在片段和活动之间进行通信。 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? 示例:当我在某个地方看到
onEvent()
方法时,如何找到触发该事件的地方?
Granted you are using IntelliJ Idea/Android Studio, and the method is onEvent*(E ...)
: 授予您正在使用IntelliJ Idea / Android Studio的方法是
onEvent*(E ...)
:
E
will move you to E
class file E
将您移至E
类文件 E
class (as in eg public class
E ) will show you all the usages of E
class in general. E
类(例如在public class
E中 ),通常会向您显示E
类的所有用法。 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. 奖励:如果事件类只有一个构造函数,则最好Ctrl +单击它而不是类名。 This will show you places where the event object is created.
这将显示创建事件对象的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.