AndroidKnife / RxBus

Event Bus By RxJava.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documentation/example is incomprehensible

RobLewis opened this issue · comments

I cannot make sense of your example. More questions than answers.

have any ideas? what's your question?

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();
}