android data binding support library
TRANSCRIPT
![Page 1: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/1.jpg)
Data Binding Support Library
developer.android.com/tools/data-binding
/guide.html1
![Page 2: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/2.jpg)
Data Binding Engine
- Declarative layouts(implicit data/command binding)
- Minimize app logic-to-layout binding code
- Model View ViewModel (MVVM)
2
![Page 3: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/3.jpg)
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
![Page 4: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/4.jpg)
4
![Page 5: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/5.jpg)
5
![Page 6: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/6.jpg)
Specs & Syntax
- Support Lib Android 2.1(API 7+)
- Beta Release : Android Studio 1.3.0-beta1+
- <layout> <data> <variable> <import>
- “@{ }” “@{user.firstName}” 6
![Page 7: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/7.jpg)
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
![Page 8: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/8.jpg)
Layout and Variable Bind Example
8
![Page 9: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/9.jpg)
Import and Static Method Call Example
9
![Page 10: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/10.jpg)
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
![Page 11: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/11.jpg)
Data Object and Observable Examples
11
![Page 12: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/12.jpg)
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
![Page 13: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/13.jpg)
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
![Page 14: Android Data Binding Support Library](https://reader033.vdocuments.mx/reader033/viewer/2022052509/55b6ded4bb61ebed588b4846/html5/thumbnails/14.jpg)
https://github.com/ersin-ertanhttps://plus.google.com/+ErsinErtan1
Ersin Ertan
14