上篇博客知道了,Rxjava有四个事件组成:
observe(观察者),observable(被观察者),subscribe(订阅事件),事件
observe:没有具体的实现方法,只有三个方法,
1.onCompleted():
Notifies the Observer that the Observable has finished sending push-based notifications,The {@link Observable} will not call this method if it calls {@link #onError.
通知观察者基于被观察者的推送通知已经完成,如果调用onError方法,就不会调用这个方法。
2.onError(Throwable e):
Notifies the Observer that the {@link Observable} has experienced an error condition,If the {@link Observable} calls this method, it will not thereafter call {@link #onNext} or
{@link #onCompleted}.
通知观察者被观察者遇到了错误,如果被观察者调用了这个方法,将不会再调用onNext或者onCompleted.
3.onNext(T t):
Provides the Observer with a new item to observe,The {@link Observable} may call this method 0 or more times,The {@code Observable} will not call this method again after it calls either {@link #onCompleted} or {@link #onError}.
提供了一个新的item同观察,被观察者可能会调用这个方法0次或者多次,被观察者调用了onCompleted或者onError将不再调用这个方法。