Search code examples
androidandroid-databindingandroid-viewbinding

Why use ViewBinding over DataBinding?


As we can read here there is very small difference between ViewBinding and Databinding.

  • The data binding library processes only data binding layouts created using the <layout> tag.

  • View binding doesn't support layout variables or layout expressions, so it can't be used to bind layouts with data in XML.

Are there any other differences that developers should be aware of? Why create something new with such a small difference?

Someone please explain


Solution

  • Why create something new with such a small difference?

    Build times for view binding are much lower than for data binding, because there is a lot less work involved. For small projects, this may not matter. For large projects, the impacts on build times can be substantial.