O'Reilly logo

Reactive Android Programming by Tadas Subonis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Basics of Subjects and Preference Persistence

Sometimes, it is necessary to have an object that can subscribe to an Observable while being able to act as an Observable at the same time. It is useful to have a way to glue different Observables in an independent manner.

A Subject is a way to do this in RxJava and, in this chapter, we will explore various types of Subjects and on what occasions they should be used.

In RxJava, there are four different classes of Subject:

  • ReplaySubject
  • AsyncSubject
  • BehaviorSubject
  • PublishSubject

Each of them has different use cases, and we will cover their unique aspects so that the developer will be able to make the correct choice.

Furthermore, in this chapter, we will see how we can use Subject for preferences ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required