Using RxBinding

RxAndroid does not have any tool to create an Observable from an Android event, but there are many libraries that provide the means to do this. The most popular library is RxBinding, which allows you to create an Observable from 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 an Observable from controls that extend View and broadcast different events as emissions. For instance, create a new project by following the steps in the previous section and make sure that the build.gradle file has the same content. If not, copy its content from the previous project. Then, change your activity_main.xml file by adding Button ...

Get Learning RxJava - Second Edition now with O’Reilly online learning.

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