Posts

Showing posts with the label databinding

Databinding in RecyclerView - Android - Kotlin

Image
Hey Guyss!! Already we have seen the basics of Databinding and how to use it in previous  post . Now let's see how to use Databinding in RecyclerView . And Its gonna be a short post. ;) You can find the Project in GitHub . Prerequisite: build.gradle First, we have enable dataBinding in app-level build.gradle                           android {                                     dataBinding {                                             enabled = true                                     }                            } Next, we hav...

Exploring Databinding Library in Android - Kotlin

Image
Introduction: Data binding library is a support library, which allows us to bind data sources directly to UI components of layout file. Binding components this way, reduces boilerplate code in our business logic where we usually update UI when new data is available. It also improves app's performance and helps to prevent memory leak and NullPointerException. textView.text = user.name can be written simply in layout as follows, and no need to write in Activity class.                                                             <TextView                                                                   ...            ...