基本使用

自定义一个类

public class LoginEvent {
private String code;//是否成功

public LoginEvent(String code) {
this.code = code;
}

public String getCode() {
return code;
}

public void setCode(String code) {
this.code = code;
}
}

在要接收消息的页面注册:

   eventBus.register(this);  

public void onEventMainThread(LoginEvent event) {

}

 

解除注册

eventBus.unregister(this);  



引入EventBus:
compile 'org.greenrobot:eventbus:3.0.0'



相关文章:

  • 2021-08-20
  • 2021-10-22
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
猜你喜欢
  • 2021-12-29
  • 2022-02-18
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2022-01-12
  • 2021-11-09
相关资源
相似解决方案