...

/

Observable and Observer

Observable and Observer

Learn about the various methods offered by Observables and Observers.

We'll cover the following...

An Observable can emit any number of items. As mentioned, to receive or listen to these emitted items, an Observer needs to subscribe to the Observable. The .subscribe() method is defined by the ObservableSource interface, which is implemented by Observable.

Press + to interact
public interface ObservableSource<T> {
void subscribe(Observer<? super T> observer);
}

Once the Observable and Observer have been paired via the .subscribe() method, the Observer receives the following events through its defined methods:

  • The .onSubscribe() method is called
...