250 likes | 409 Views
Android for Java Developers. Denver Java Users Group Jan 11, 2012 -Mike Wolfson @mikewolfson. Why Android?. Open APIs – everyone’s equal Low Barrier to entry Run app on your own device - $0 Sell through Google Market - $25 Easy to develop apps Especially for Java Developers
E N D
Android for Java Developers Denver Java Users Group Jan 11, 2012 -Mike Wolfson @mikewolfson
Why Android? • Open APIs – everyone’s equal • Low Barrier to entry • Run app on your own device - $0 • Sell through Google Market - $25 • Easy to develop apps • Especially for Java Developers • Platform agnostic • Open Market (or download from anywhere) • Feature Rich platform
Framework Overview http://developer.android.com/guide/basics/what-is-android.html
Framework – Linux Kernel Core system services • Handles security, memory management, process management, network access, etc • Abstraction layer between OS and hardware
Framework - Dalvik Virtual Machine • Optimized for mobile devices • Every app runs in its own instance of VM • Runs classes compiled by Java, and transformed into .dex files
Framework - Libraries Variety of libraries to provide built in functionality.
Framework – Application Framework Provides functionality to allow Applications to interact with underlying OS and other applications Designed to simplify the reuse of components, and allow applications to publish, or make use of the capabilities of other applications
Framework – Applications The layer where custom-built applications live. This is the place where most mobile developers will interact with Android. Your App Here!
Get Developer Tools • SDK • http://developer.android.com/sdk/index.html • Requires Java SDK (5.0 +) • Updating versions • What the different versions mean • ADT Plugin (for Eclipse) • http://developer.android.com/guide/developing/tools/adt.html • Need Eclipse Ganymede (3.4+) • Update site: https://dl-ssl.google.com/android/eclipse • Can develop without Eclipse
Developer Tools (cont) • Android command • Emulator • Android Virtual Devices (AVD) • Android Debug Bridge (ADB) • Command line tool for interacting with phone/emulator. • Dalvik Debug Monitor Server (DDMS) • Debugging tool providing: screen capture, memory info, logging, info spoofing) http://developer.android.com/guide/developing/tools/index.html
Developing an App • Create a new project • Project content overview • Code • Test on emulator (or device) • Debug • Sign • Export to device • As APK (Android PacKage file)
Terminology • Most Commonly used elements • Activity • Intent • Manifest file • Resources and Assets • Layout • Fragment
Terminology - Layout Layout – describes the UI of an activity • Enables separation of UI from logic • There are a variety of layouts you can use including: Linear, Table, Relative, and Frame
Terminology - Activity Activity – (Noun) A single screen, your application is made up of one or more of these. • Always extends Activity
Terminology - Intent Intent – (Verb) code to perform an action • Wiring between activities, services, broadcast receivers, or other functions • facility for late run-time binding between components in the same or different applications • Rich set of Intent in Android provide excellent way of executing specific actions
Fragments Fragments represent a behavior or portion of a UI. • Designed to collect a unit of UI and behavior into a reusable component • Don’t have own lifecycle – and must be embedded in an Activity
Terminology - Manifest Manifest File – describes your app • always named AndroidManifest.xml • declares the components of an application, describes security permissions required by the app, and lists required library dependencies
Terminology - Resources Resource – text, pictures, sound, etc • are all abstracted from the code and logic • compiled and managed by system generated R.class file • Instantiate by getting reference to object
Resources • Multiple Layouts and Graphic Assets • Can also be Used for language localization • Tip: use Density Independent Pixels (DP) • Draw9Patch
Terminology - APK • Android Application File • User can install apps from many sources • Developer can upload updates easily
Terminology – cont. • Other important elements • Widget • Service • Broadcast Receiver • Security and Permission • Content Provider
Learn More • http://developer.android.com • Denver Droids • http://www.denverdroids.com/ • http://forum.xda-developers.com • http://www.stackoverflow.com • http://developer.android.com • Google Groups (Forums)
Questions? • @mikewolfson • Google +: Mike Wolfson • mwolfson@gmail.com • Slideshare: http://www.slideshare.net/mswolfson • Dropbox: http://dl.dropbox.com/u/23589031/DJUG.zip • Beer?!