Using RxBinding

RxAndroid does not have any tools to create Observables off Android events, but there are many libraries that provide means to do this. The most popular library is RxBinding, which allows you to create Observables off of UI widgets and events.

There are many factories available in RxBinding. One static factory class you may use frequently is RxView, which allows you to create Observables off controls that extend View and broadcast different events as emissions. For instance, change your activity_main.xmlto have a Button and TextView class, as follows:

 <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout     xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" ...

Get Learning RxJava now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.