2. Data binding library (Beta)
• Write apps faster.
• Minimize glue code for UI.
• No more findViewById(R.id…)
• Bind data and UI with minimum lines of code.
• Move basic UI logic from java class to xml layout file.
• Bind data (custom variables) and events. Define custom attributes.
• Supported all the way back to Android 2.1
• Available on android studio 1.3+ (Gradle plugin 1.5+ required)
3. Setting up studio for DBL
• Prerequisites - Android studio 1.3 +, Gradle plugin 1.5.0-alpha1 +
• Project gradle file: • Module gradle file
• And done...
4. Writing Data Bind layouts
Change the root element of layout… To this
Old_sample_layout.xml
Dbl_layout.xml
5. Writing Data Bind layouts…
• What happens when an xml layout is defined with layout root tag?
• A binding file is generated. For prev example it will be DblLayoutBinding.java
• This contains references to all the child views (as public final fields).
• This binding file can now be used to populate data
• What is that <data> tag?
• In data tag we tell the layout processor that a java class will be used to populate data.
• We can import custom or android classes inside data element.
• Multiple variable declaration and imports are possible inside data tag.
• Custom attributes and more in Demo…
9. What is android studio???
• Google’s IDE for android development.
• Built in support for Google cloud platform.
• Flexible Gradle-based build system.
• Built on top of latest IntelliJ IDEA platform.
• Multi screen app development.
• Latest version 1.5.1.
• Available on android developer site. http://developer.android.com/sdk/index.html
10. Some changes since studio 1.0 (DEC 2014)
• New Memory / GPU / CPU monitor
• Vector asset studio.
• Theme editor
• Integrated SDK manager.
• Data binding support and HAXM optimizations
• Enable AdMob and Analytics from within android studio.
• Live templates for quick code insertion.
• And many more…
11. • Available in stable build channel.
• http://tools.android.com/download/studio/builds/2-0-preview.
• Not recommended (still in preview stage).
• Canary channel (Preview 6 available on Jan-20,2016).
• http://tools.android.com/download/studio/canary/latest
• Download a separate build.
How to get the 2.0 preview?
12. • IDE Enhancements
• Build System
• Android Emulators
What’s new in studio 2.0 (preview)
13. • IntelliJ 15 support (15.0.2).
• New GPU profiler (experimental preview).
• Google search deep linking support in built.
• Instant Run (Continued…)
• Lot of UI improvements.
IDE Enhancements
14. • Improved dx merger (Build tools 23.0.2+, Gradle 2.0).
• Pre-dexing dependencies. Gradle build 2-2.5 times faster.
• New experimental shrinker for debug mode.
• Shrinking only. No Obfuscation No Optimization.
• Overall build – deploy – install cycle is ~1.5 times faster.
• New protocol for ADB push / pull.
• Huge speed improvement.
• Instant Run (Gradle 2.0-alpha5+, gradlew 2.10).
• Hot swap, cold swap, freeze swap
Build System
15. • Completely new UI with extended controls.
• Control almost every feature of emulated device
• Drag and drop APKs and files.
• Send SMS, receive calls.
• System keyboard support & Resizing.
• Finger printing support.
• Select number of cores (experimental and based on number of cores in system)
• And more in demo.
Emulator 2.0 (requires SDK tools 25.0+)
16. How long would it take
to develop this?
Divide that time by 2 with
DBL
Even lesser with instant run
Editor's Notes
Welcome!!!
Introduction
The idea is to connect data model to UI elements
Binds data to UI view model
No Reflection. Preprocessing is done at run time
It is a support library
Migrating from old layouts to Data bind layouts is very easy
Also explain some of the new features since earlier versions of android studio
Also explain some of the new features since earlier versions of android studio
Do not upgrade your current IDE, instead have a separate copy of studio 2.0 till it is in preview stage
Significant huge improvements in android studio 2.0.
Eclipse users please switch to android studio now.
Much faster and developer friendly
Other UI improvements like
Project structure
Welcome screen
Deployment targets
AVD manager
Instant run is the ability to deploy code changes on the fly, more will be covered in later.
Discussion topic: How does it work
Hot swap – deploy code changes without app restart (App is running)
Cold swap – deploy incremental changes with app restart (App is running)
Freeze swap – build and deploy incrementally (app is not running)
Freeze swap is out of scope
DBL supported by instant run
With this release emulators will be preferred over actual devices
Get the latest SDK tools from tools preview channel in SDK manager
Send SMS and receive calls, without having a second emulator
What can be controlled:
GPS location, signal strength, battery, data roaming 2G/3G/No service
Power button