RxJava meets Android Data Binding

Including code examples and working project

Radosław Piekarz
Tango
Published in
3 min readOct 3, 2016

--

Probably every Android developer is using or at least heard about RxJava. Currently, there are lots of libraries that use the reactive approach, let RxPreferences, RxLocation, RxPermissions, RxWear, RxBinding serve as an example. But let’s go back to the beginning.

Here at Tango we are using RxJava in every Android project because it accelerates application development and helps us in the fight with callback hell. We have been successfully using the reactive approach with our custom made MVP framework and currently in all our new projects we are using it with MVVM design pattern. Unfortunately, some Android developers know RxJava only from examples which show how to implement GitHub repositories browser using Retrofit. However, RxJava is doing great in situations when we are dealing with data or event streams which can be really useful in combination with Android Data Binding. Let’s focus on the code below.

There is the binding expression in line #4 which set enabled attribute to true|false depending…

--

--

Radosław Piekarz
Tango
Editor for

Head of Mobile at Tango Agency (@Tango_Agency). More blog posts on https://droidlabs.net/