easier android development with titanium
DESCRIPTION
Tips and tricks to make your Android development with Titanium as painless as possible. Android can be as functional and (almost) as performant as iOS with less 'if' statements. From #ticonf Australia, August 2013.TRANSCRIPT
![Page 1: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/1.jpg)
Jeff Bonnes
twitter: @titaniumdev
http://www.titaniumdevelopment.com.au
Easier Android Development
![Page 2: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/2.jpg)
Agenda
• Android Market and Behaviours
• Planning your App
• Smarter Defaults
• Tips, Tricks and Advice
![Page 3: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/3.jpg)
Background
![Page 4: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/4.jpg)
App Download Culture
0
25
50
75
100
iOS Android
![Page 5: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/5.jpg)
App Download Culture
![Page 6: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/6.jpg)
Android by the numbers• Australian Market Share (Dec 2012)
0% 10.0% 20.0% 30.0% 40.0% 50.0% 60.0% 70.0% 80.0% 90.0% 100.0%
iOS Android
![Page 7: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/7.jpg)
Android by the numbers
• Australian Market Share (Dec 2012)
• US Market Share
• Why?
![Page 8: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/8.jpg)
X-platform Examples
![Page 9: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/9.jpg)
X-platform Examples
![Page 10: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/10.jpg)
X-platform Examples
![Page 11: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/11.jpg)
X-platform Examples
![Page 12: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/12.jpg)
Before you code• Target API?
![Page 13: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/13.jpg)
Before you code• Devices / Screen Sizes?
![Page 14: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/14.jpg)
Coding Approaches
• Different Apps
• Different UI Code
• Different CommonJS Modules
![Page 15: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/15.jpg)
Project Setup
• dps vs pixels
• density specific images
![Page 16: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/16.jpg)
Project Setup
• Other tiapp.xml values
![Page 17: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/17.jpg)
Development Workflow• You are using TiShadow, aren’t you?
• fastdev
• Android 2.3 in Emulator, 4.x on device
• Intel x86 Atom System Image: no Google APIs :-(
• VM for Emulator
• tracer.js
![Page 18: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/18.jpg)
Navigation
![Page 19: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/19.jpg)
Action Bar
• Android 3.0+ only
• Must use Heavyweight windows
![Page 20: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/20.jpg)
Alternate Navigation• TiXUI
• title
• titleControl
• barImage
• rightNavButton
• leftNavButton
require('xui').createWindow();
![Page 21: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/21.jpg)
Light vs Heavy Windows
• Activity
• Back Button
• Animation
• activityEnterAnimation
• activityExitAnimation
• Memory?
• fullscreen• navBarHidden• modal• windowSoftInputMode
![Page 22: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/22.jpg)
Images
• Don’t allow Android to stretch images
• Don’t use images for backgrounds (especially windows!)
![Page 23: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/23.jpg)
Show only what you need
• Things are S L O W E R
• JSON Parsing
• SQLite Updates
• event firing
• Load things only as you need them
![Page 24: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/24.jpg)
Freeing Resources
• Close Windows
• Memory Debugging
• Instruments first
• then DDMS
![Page 25: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/25.jpg)
Intents
• Do less work - use less frameworks
• See Titanium.Android.Intent
![Page 26: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/26.jpg)
Packaging Tricks
• Image Compression
• uses-feature
• Icons - drawables (http://ticons.fokkezb.nl/)
![Page 27: Easier Android Development with Titanium](https://reader033.vdocuments.mx/reader033/viewer/2022052821/554a1757b4c9055c598b50bb/html5/thumbnails/27.jpg)
Thank You!
• twitter: @titaniumdev
• http://www.titaniumdevelopment.com.au
• https://github.com/jeffbonnes/TiXUI