0

I am trying to include EventBus in my application. I followed http://tomaszdziurko.pl/2012/01/google-guava-eventbus-easy-elegant-publisher-subscriber-cases/ link.

I am getting compile errors: enter image description here

I've added the guava-16.0.1.jar to the project. But the register fucntion isn't working.

Any idea what am I missing here?

Dixit Gokhale
  • 601
  • 1
  • 12
  • 32

1 Answers1

1

You're trying to call methods on members from the class, which is not possible. Those need to go inside a method (like a constructor or initializer).

Example code:

public class EventBusTest {

  private final EventBus eventBus = new EventBus("test");

  private final MultipleListener multiListener = new MultipleListener();

  public void init() {
    eventBus.register(multiListener);
  }

}

Also, this question may be of use to help you understand Classes vs Objects

Community
  • 1
  • 1
Jason Nichols
  • 11,603
  • 5
  • 34
  • 53