99 Followers
·
Follow

Data Binding as we know is a support library part of Android Architecture Components that allows to bind observable UI components in our layouts.

Image for post
Image for post
Image Credit to https://devblogs.microsoft.com/xamarin/introduction-to-data-binding/

In last article we learned about:

  1. Benefits of Data Binding
  2. How to enable Data Binding in build.gradle
  3. How to set-up <layout/> tag in xml
  4. How to access Data Binding Object and xml view in Kotlin file

Now taking a step forward in this article we will cover how we can pass Simple objects in Xml file, Syntax and Benefits for same.

In order to use Simple Objects we need to do follow below mention steps:

  1. Create a Simple class with some…


Data Binding

It is a support library part of Android Architecture Components that allows to bind observable UI components in your layouts defined in layout folder under resources.

Traditional Approach

val textview : Textview = findViewById<TextView>(R.id.textView)

findViewByID is used to find references within views defined in layouts.So whenever this statement is used within code android systems searches for the respective view in view hierarchy which can make view creation slow in case of large views.

Ultimately, it will reduce the performance of your large application and may lead to user dissatisfaction.

Why Data Binding?

In Data binding we deal with objects i.e. Data Binding Objects. These object contains references to all the views within a layout defined under layout folder under resources. …


Image for post
Image for post
Image Credit to Android Developers(https://developer.android.com/jetpack/)

What do we need to understand when thinking about/talking about android jetpack?

These are the components(set of Tools) aligned with Architecture Design Guidelines built to help us Accelerate our Android Development(speed up development process).

This provides various templates which can be used to quickly write production ready code and speed up multiple things.

These components are simple to use, which means we can involve new developers anytime within our team for new features.

Apart from this Android Jetpack helps in :

  1. Avoid Writing Boilerplate Code
  2. Handling complex task’s easily
  3. And more importantly help us in following best practices in Android…

About

Kamal Vaid

GDE For Google Assistant,Technology Lead at Infosys Ltd, Organiser Google Developer Group Chandigarh, Lead Facebook Developer Circle Chandigarh

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store