The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


The Data Binding Framework

To quote Rudyard Kipling:

East is East and West is West, and never the twain shall meet

In many programming environments, including classical Android development, one could paraphrase Kipling as “models are models and views are views, and never the twain shall meet, except by means of some controller or presenter or something”. The result is a fair amount of code that populates views with model-supplied data and updates those models as the user alters the data in the views (e.g., types something in an EditText widget).

Data binding, in general, refers to frameworks or libraries designed to help simplify some of this data migration, where the definitions of the models and views can be used to automatically “bind” them without as much custom controller- or presenter-style logic.

Interest in data binding spiked in 2015, when Google released the first beta editions of data binding support via Android Studio, the Android Gradle Plugin, and a new data-binding support library.

This chapter explores Google’s data binding support and how to use it to simplify your Android app development.

Prerequisites

This chapter requires that you have read the core chapters of this book. In particular, the sample apps are based off of samples from the chapter on Internet access. Also, some samples use RecyclerView.

The What, Now?

The preview of this section is in the process of being translated from its native Klingon.

The Basic Steps

The preview of this section is out seeking fame and fortune as the Dread Pirate Roberts.

The Extended Layout Resource

The preview of this section was abducted by space aliens.

The Binding Expression Language

The preview of this section was stepped on by Godzilla.

Observables and Updating the Binding

The preview of this section was whisked away by a shark-infested tornado.

Two-Way Binding

The preview of this section is off trying to sweet-talk the Khaleesi into providing us with a dragon.

Other Features of Note

The preview of this section is out seeking fame and fortune as the Dread Pirate Roberts.