/**
-
发送一个新的事件
-
@param object
*/
public void post(Object object){
bus.onNext(object);
}
/**
- 根据传递的 eventType 类型返回特定类型(eventType)的 被观察者
*/
public Observable toObservable(Class eventType){
return bus.ofType(eventType);
}
}
首先我们要定义一个接受数据的实体类:
public class User {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public User(String username, String password) {
this.username = username;