Awesome Open Source
Awesome Open Source


Android Arsenal android-data-binding-rxjava Build Status

Simple demo developed with love at Tango which demonstrates how to wrap Android DataBinding ObservableField into RxJava's Observable.

With this solution it is possible to register for ObservableField's value changes and use it with RxJava operators.

You can read Medium story which explains this concept - RxJava meets Android Data Binding.

Example code

public static class MainViewModel {

        public ObservableField<String> firstName = new ObservableField<>();
        public ObservableField<String> lastName = new ObservableField<>();
        public ObservableField<String> helloText = new ObservableField<>();
        public ObservableBoolean helloButtonEnabled = new ObservableBoolean(false);

        public MainViewModel() {

            Observable.combineLatest(toObservable(firstName), toObservable(lastName), (firstName, lastName) -> StringUtils.isNotNullOrEmpty(firstName) && StringUtils.isNotNullOrEmpty(lastName))
                    .subscribe(result -> {
                        if (!result) {
                    }, Throwable::printStackTrace);

        public void buttonClicked() {
            helloText.set(String.format("Hello %s %s !", firstName.get(), lastName.get()));


How it works

You can find toObservable method implementation in class.

It uses ObservableField's OnPropertyChangedCallback and expose property change events to the "RxWorld".

Alternatives To Android Data Binding Rxjava
Select To Compare

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Java (392,531
Bindings (17,104
Rxjava (4,229
Databinding (1,484
Android Databinding (33