Documentation/example is incomprehensible
RobLewis opened this issue · comments
RobLewis commented
I cannot make sense of your example. More questions than answers.
Carlos Hwang commented
have any ideas? what's your question?
Atiq Ur Rehman commented
To be honest, I can't get it to work either.
Can you please make a simplest sample or write an equivalent code to this:
@Override protected void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override public void onClick (View view){
EventBus.getDefault().post(new SimpleEvent("Hello"));
}
});
}
@Override protected void onStart (){
super.onStart();
EventBus.getDefault().register(this);
}
@Override protected void onStop (){
EventBus.getDefault().unregister(this);
super.onStop();
}
@Subscribe
public void onEvent(SimpleEvent event){
Log.i(TAG, "onEvent: " + event.msg);
Toast.makeText(this, "" + event.msg, Toast.LENGTH_SHORT).show();
}