In I/O 2015 Google announced a data binding library for Android. With Data Binding, you create an ongoing link between an element in the user interface and a value. Data Binding is the process that establishes a connection between the application UI and business logic.
In this post we will learn how to integrate recyclerview with android Data Binding.
Step 1 : Enable dataBinding in your module level gradle, here is how your build.gradle should look like.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion "23.0.3" defaultConfig { applicationId "com.androidgig.recyclerviewbinding" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" dataBinding{ enabled true } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:recyclerview-v7:23.4.0' compile 'com.squareup.picasso:picasso:2.5.2' } |
Continue Reading →
In earlier posts we have already seen
- Working with DataBinding Android
- Image Loading with DataBinding in Android
- Two-way DataBinding in Android
- Setting custom font through XML with DataBinding
Today we will discuss more about Advance DataBinding
Binding Events :
Events will be bound to handler methods directly, like we used to do it with android:onClick. Only change will be we have to take reference of our interface(handler).
Continue Reading →

In the earlier posts we have seen how to use DataBinding, Setting custom font and Image loading. Today we will discuss about two-way DataBinding.
What is Two-way DataBinding?
Till now we have seen how to set values to xml view, but in controls like EditText we need to fetch value. In simple term two-way DataBinding is setting values to that control and fetching it after having some changes.
ObservableField
ObservableField can be used instead of extending BaseObservable class. ObservableFields are self-contained observable objects that have a single field.
Continue Reading →

In I/O 2015 Google announced a data binding library for Android. With data binding, you create an ongoing link between an element in the user interface and a value. Data binding is the process that establishes a connection between the application UI and business logic.
As a developer we always try to do tasks with lesser code, findViewById and setText would be the things which will increase line of codes. Data binding eliminates needs of these methods.
DataBinding is a support library so you can use it with the version higher than Android 2.1. Now we will see step by step instruction for how to use DataBinding in real time.
Continue Reading →