I am using Greenbot EventBus in my app and am getting like a 2 second delay when I press a button that fires an event.
My EventBus class ResetArmyEven.java
public class ResetArmyEvent {
}
it is triggered here:
public void onClick(View v) {
ResetArmyEvent resetArmy = new ResetArmyEvent();
EventBus.getDefault().post(resetArmy);
}
I am using this in Fragment A to trigger two events, one in Fragment B and the other in Fragment C. This is my onEvent() trigger
public void onEvent(ResetArmyEvent event) {
Utilities.resetArmyAmounts(troopAmountArray);
}
This is the method it calls
public static void resetArmyAmounts(EditText[] amountsArray) {
for (EditText amount : amountsArray) {
amount.setText("");
}
}
I have tried changing what the event is doing (just simply sending a toast) and that did not help. I have also tried changing the way it is fired (firing method in the XML), and that did not help.
The button has a ripple effect, and even that takes like 2 seconds to trigger. When I remove the EventBus events then it fires right away. So it seems like it has something to do with EventBus. Any ideas on how to speed this up? What am I doing wrong? Thanks.