Reactive Everything: View Events
Learn how to turn View events into Observable streams.
UI events, such as Button
clicks or changes in an EditText
, are another good place to use RxJava. An open-source library, RxBinding, created by Jake Wharton, provides the necessary bindings to turn View
events into Observable
streams.
Using RxBinding, we can turn View
click events into an Observable
.
Press + to interact
Observable<Object> clicks = RxView.clicks(view);clicks.subscribe(obj -> {// Get click events here});
Example
This ...