Android development Tutorial-Using Data Binding (a) Introduction

Source: Internet
Author: User

Introduction

Data binding, published in the 2015 Google I/O Conference, aims to reduce the number of template code (such as Findviewbyid ()) in Android development, add code and logical clarity, and improve development efficiency and maintenance efficiency.

What is Data Binding

Data binding, or databinding, is a way for the Android team to implement the MVVM architecture so that data (objects) can be directly bound to the layout's XML, and data changes are reflected directly on the view.

At the same time, the Data binding also supports two-way binding.

What good is it?
    • Save a lot of template code, such as Findviewbyid (), Setonclicklistener (), SetText (), and so on.
    • Makes view and logic complete decoupling (MVVM) possible, unlike MVC, where logic is difficult to maintain with view operations, and does not define a large number of interfaces like MVP, which can be time consuming and laborious.
    • Since the data (object) is bound to the view in two directions, it is only necessary to focus on the data (object) in development, without concern for the various miscellaneous operations of the view (e.g. Setvisibility (), SetText (), etc.)
    • Powerful, simple logic in XML (supports expression language, logical/mathematical operations, etc.)
Easy to use?

The integration is simple and easy to use, enabling your project to support data Binding with just one configuration.

android {    …    dataBinding {        enabled = true    }}

Specific use steps, you can click Next: Data Binding integration and configuration

Android development Tutorial-Using Data Binding (a) Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.