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 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.