SlideShare a Scribd company logo
Data Binding Support
Library
developer.android.com
/tools/data-binding
/guide.html1
Data Binding Engine
- Declarative layouts(implicit data/command
binding)
- Minimize app logic-to-layout binding code
- Model View ViewModel (MVVM)
2
Model View ViewModel
- used in Microsoft frameworks with XAML as
binding language
- Variant of MVC pattern
- M : domain model
- V : view
- VM : mediator, binds view, reacts to events
3
4
5
Specs & Syntax
- Support Lib Android 2.1(API 7+)
- Beta Release : Android Studio 1.3.0-beta1+
- <layout> <data> <variable> <import>
- “@{ }” “@{user.firstName}” 6
Allowed / Disallowed Syntax
- math, string concat
- logical, binary,
unary, ternary, shift
- instanceof, cast,
method call
- grouping, field and
array access
- literals, comparisons
- this
- super
- new
- explicit generic
invocation
7
Layout and Variable Bind
Example
8
Import and Static Method
Call Example
9
Data Object
- POJO/Beans modification doesn’t update UI
- <variable> types inspected on compile,
must implement Observable via
BaseObservable and @Bindable
- Observable, Observable Field, Observable
Collection : are notified on data change 10
Data Object and
Observable Examples
11
Why?
- fragments traditionally create, bind,
configure views, and hold the domain logic;
can be limited to binding
- UIs react to changes in the ViewModel,
asynchronous updates on the UI thread and
from background threads ∴ responsive UI
- 12
Why Continued
- HTTP/2 Request and Response Multiplexing
- Increase in local and remote inter-process
communication as apps get more complex,
and as they get more connected(IoT,
Bluetooth, Wifi)
13
https://github.com/ersin-ertan
https://plus.google.com/+ErsinErtan1
Ersin Ertan
14

More Related Content

Android Data Binding Support Library