Why Java?• Mature Language• Massive open source community• Excellent tools/IDEs• Large, slow bloated Virtual Machine - Dalvik = Small, fast optimized Virtual Machine• All benefits, no disadvantages - Except?
What is Android?How was growth achieved?• Operating system, built on Linux• Compiler, debugger, emulator, VM• Open sourced code under Apache 2 license• Open Handset Alliance – 84’ish Companies - Why? - Open standards to allow it to grow - Ability to compete – Apple, Symbian/Nokia, RIM, Microsoft - Google = Smart• Android vs. iPhone?
Open?• Yes… but No…• Open - A license that insures the code can be modified, reused and distributed - A community development approach - Assurance the users have total freedom over the device and software.• Google has achieved ½ of openness – Legally Open Source• Is their ‘community development approach’ any different than Apple or RIM?
Money?• What kind of a company is Google?• How do they make money?• Android simply makes them better at doing what they’ve always done best.
3 Things• Activities = Screens• Views/Widgets = Components• Intents = Messages - used for navigation (among other things)
Activities = Screens• Screens have lifecycles on Mobile devices - onCreate() — Activity is first created - onStart() — Becomes visible - onResume() — Interacting with the user - onPause() — Current activity-> another activity resumed - onStop() — No longer visible to the user - onDestroy() — Before the activity is destroyed - onRestart() — Restarting again
Views• Basic building block for UI components Layout Widget ViewGroup View
Views – Cont’d• To add views to a screen/activity, create hierarchy of views, then call setViewGroup(…) in the activity.• Layout may contain layout and buttons, text fields, radio buttons, etc.
Intents = Messages• Main communication mechanism in Android1) Used to call other apps or screens – This is us!2) Send a message to someone who is listening - Low battery - Time zone change3) Start a service - Download a file - Start/Check the status of a process
Intents/MessagesWhat do they contain?• Component name – Unique identifier of component - This is an explicit intent• Activity - ACTION_CALL - ACTION_EDIT - ACTION_SYNC - ACTION_VIEW• Data - URI and MIME type (http://www.protegra.com)• Category - Logical Grouping of activities• Extras - Key/Value pairs