Chapter 1. An Introduction to RxJava

Sharp Learning Curve, Big Rewards

I was pretty much dragged into RxJava by my coworkers...[RxJava] was a lot like git...when I first learned git, I didn’t really learn it. I just spent three weeks being mad at it...and then something clicked and I was like ‘Oh! I get it! And this is amazing and I love it!' The same thing happened with RxJava. 

Dan Lew1

As Dan Lew, a Google Developer Expert Android Developer, points out in the preceding quotation, RxJava can be very difficult to learn. This is unfortunate because, for reasons I point out in the next chapter, RxJava can make asynchronous data handling in Android apps much cleaner and more flexible. In this chapter, I provide a basic introduction to RxJava.

If you are skeptical that RxJava is worth learning about, given its steep learning curve, skip ahead to the second section of the next chapter. In that section, I go over a situation in which RxJava provides us with advantages over traditional ways of handling asynchronous data in Android applications. Although you won’t understand exactly how the code in that section works, you will be able to see how RxJava makes quick work of tasks that can often become messy and inflexible when handled without RxJava. After seeing how much cleaner RxJava can make your Android code, hopefully you will have the motivation to return here to this introduction. 

Let’s start with the guiding example that will help us get a handle on RxJava. Imagine we are ...

Get RxJava for Android App Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.