Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 1.17 KB

README.md

File metadata and controls

44 lines (30 loc) · 1.17 KB

Databinding

The application covers general areas on databinding by showcasing databinding in recycler view adapter,in activities and using a simple case of a binding adapter.

Databinding lets you bind UI components in your layouts to data sources in your app using a 
declarative format rather than programmatically.

What this means is you simply tell your layouts the data it will be handling and which view will show what aspect of the data as compared to using findViewById() and setting the data to each view in code.

Screenshots

With dataBinding you don't need to make use of textView = findViewById(R.id.tvMyID) Instead you just have to do a direct castout from your layout in the textview as android:text"@{className.propertyValue}"

to make sure android studio know you are using dataBinding, you have to set it on your gradle file

 dataBinding {
        enabled = true
    }

for android studio 4+ you can use

  buildFeatures {
          dataBinding true
    }

Reference