Search⌘ K
AI Features

Reactive Everything: View Events

Explore how to use RxJava and the RxBinding library to convert Android view events such as button clicks into Observable streams. Understand how to apply operators like buffer and filter to detect complex gestures like double clicks. This lesson helps you implement reactive event handling on Android for improved UI responsiveness and cleaner code.

We'll cover the following...

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.

Java
Observable<Object> clicks = RxView.clicks(view);
clicks.subscribe(obj -> {
// Get click events here
});

Example

This example is quite simple, but the ...