RxJava Android Tutorials

In this series of posts i will be covering RxJava which can used in android for asynchronous work. It extends the observer pattern to support sequences of data/events and adds operators that allow you to compose sequences together declaratively while abstracting away concerns about things like low-level threading, synchronization, thread-safety and concurrent data structures.

rxjava flow diagram

This diagram shows how function is applied on data which is emitted by Observable.

How to Design Using RxJava

To use RxJava you create Observables (which emit data items), transform those Observables in various ways to get the precise data items that interest you (by using Observable operators), and then observe and react to these sequences of interesting items (by implementing Observers or Subscribers and then subscribing them to the resulting transformed Observables).

A subscriber can get 3 major events :

  • onNext() : Called when data after some transformation comes to subscriber.
  • onError() : Some error occurred while processing.
  • onCompleted() : When data emission is completed.

Adding dependency to build.gradle file

RxJava can be added to android application by simply adding gradle dependency.

Since we will be using this on android so we have to add dependency of RxAndroid in gradle file.

Final module level build.gradle should contain highlighted lines.

Thats all you need to add for to use RxJava in your application. Lets now explore examples .

Examples for RxJava :

  1. Adding lambdas support to Android Studio

  2. Use RxJava instead of AsyncTask Android

  3. Using RxBinding instead TextWatcher on EditText

  4. Using RxJava with Retrofit2



Technology enthusiast. Loves to tinker with things. Always trying to create something wonderful using technology. Loves coding for Android, Raspberry pi, Arduino , Opencv and much more.

You may also like...

5 Responses


    This is way old example, rxJava version 2 has also released long time ago. please put some post about latest things.

  1. January 3, 2017

    […] a days. We will be covering how RxJava will do the work of  AsyncTask. This post is included in series of post which will cover RxJava in […]

  2. January 18, 2017

    […] allow you to react to user interface events via the RxJava paradigm . This post is included in series of post which will cover RxJava in […]

  3. January 31, 2017

    […] Adding RxJava support […]

Leave a Reply

Your email address will not be published. Required fields are marked *