1

Basing on the RoboGuice API for firing an event, inside my CustomButtonView implementation I have did like so:

@Override
public void onClick(View v) {
    CommonApplication.getInstance().fireEvent(new InteractionButtonClicked());
    // setSelected();

}

public class InteractionButtonClicked
{
    public String getRef()
    {
        return (String)getTag();
    }

}



// handle the click event
protected void handleClick(@Observes InteractionButtonClicked button) {
    if (getTag().equals(button.getRef())) {
        //do A
    } else {
        //do B
    }
}

However, handleClick does not get called in this context=> when I set an @Observer in the main activity it's containing method does get called.

I'm trying to understand why, and if there is an option to observe the event in the Customview context...

Elad Gelman
  • 1,182
  • 1
  • 13
  • 27
  • Have you tried to inject `EventManager`? `@Inject private EventManager eventMgr; /*...*/ eventMgr.fire(new InteractionButtonClicked());` in your `CustomButtonView`. – naXa stands with Ukraine Jan 14 '15 at 14:56

0 Answers0