You are on page 1of 17

Singapore Android Developer Challenge

Introduction to Android Programming


By: Tee Meng Kem and Sun Jian Email : f11632@motorola.com and sun@motorola.com

AGENDA
Day 1
9.00am 9.30am 9.30am 12.30pm 12.30pm 1.30pm p p 1.30pm 2.30pm 2.30pm 3.00pm 3.00pm 5.00pm 3 00pm 5 00pm : Introduction and Overview of Android : Android Application, User Interface/Activity, Resources and Assets, Permissions : Lunch : Intents, Thread : Storage (files and databases) : Hands-on Hands on

Android Developer Competition

AGENDA
Day 2
9.00am 10.30am 10.30am 12.00pm 12.00pm 1.00pm 1.00pm 2.00pm p p 2.00pm 5.00pm : Input Handling & Sensors : Network / WiFi /BT : Gaming : Lunch : Hands-on

Android Developer Competition

Introduction and Overview of Android


Day 1
9.00am 9.30am 9.30am 12.30pm 12.30pm 1.30pm p p 1.30pm 2.30pm 2.30pm 3.00pm 3.00pm 5.00pm 3 00pm 5 00pm : Introduction and Overview of Android : Android Application, User Interface/Activity, Resources and Assets, Permissions : Lunch : Intents, Thread : Storage (files and databases) : Hands-on Hands on

Android Developer Competition

Useful Links for Android


Useful links that you can find online: Android Developer Guide http://developer.android.com/guide/index.html API References http://developer.android.com/reference/packages.html p p p g Motorola Developer Network http://developer.motorola.com p p Google Developer Conference IO Session http://code.google.com/events/io/2009/sessions.html
Android Developer Competition

Useful Links for Android


Useful links that you can find online: Eclipse IDE http://www.eclipse.org/downloads/ Android SDK http://developer.android.com/sdk/index.html ADT Plugin for Eclipse http://developer.android.com/sdk/eclipse-adt.html Android Platform http://developer.android.com/sdk/adding-components.html

Android Developer Competition

Android An Evolution
AndroidTM is a new runtime environment from Google Inc.

Android is based on LinuxTM OS kernel JavaTM language based middleware

Android Developer Competition

Android Foundations
Linux Operating System:
Ex: Device drivers, networking (WiFi, Bluetooth), file system and memory management, process model

Open Source Libraries:


Ex: WebKit, SQLite, OpenGL, FreeType, etc.

Java Language and Middleware (Dalvik Virtual Machine)


All Android applications (system and user) are written in Java.
Android Developer Competition

Android Architecture

Android Developer Competition

What is New in Android


All applications are equal pp q All applications (pre-loaded and 3rd party) are written in Java and use the same APIs Each application runs in its own Linux process with its own VM and unique user ID All applications can run concurrently or in the background Applications have access to device APIs Sensors like accelerometer, compass, GPS, etc. p Declarative Android UI based on XML layout files Designed to be localized
Android Developer Competition

Android Application Packaging


Android applications are p pp packaged as ZIP files with the g extension .apk (Android Package) Contents: AndroidManifest.XML (Similar to Jar Manifest, but more details) classes.dex (Cl l d (Class fil converted t D l ik f files t d to Dalvik format) t) resources (localized strings and graphic files) Other meta information files APK files are generated by using the Android Asset Packing Tool Tool (AAPT)
Android Developer Competition

Android Application Concepts


Activity: y An Activity is the most basic building block of an application Typically an application has one or more Activities An Activity corresponds to one UI screen When user switches the view to a different activity, the current activity is put to paused state

Android Developer Competition

Android A li ti C t Application Concepts


Service: Services are background tasks which execute without a UI, such as media players, download managers, etc. Bind your code to a running service via a remote-able remote able interface defined in an IDL Note: N t With A d id 3rd party applications can ( d are encouraged Android, t li ti (and d to) re-use and/or replace system components!

Android Application Concepts


Content Providers: Components which share data, typically abstract access to application database (e.g. Contacts). Broadcast Receivers: Code which is executed for system wide broadcast y messages, like picture taken, low battery, etc. Think of them as a way to respond to external notifications or alarms Applications can invent and broadcast their own Intents as well
Android Developer Competition

Intents
Intents: Asynchronous communication mechanism between components

Copyright py g
Copyright 2009-2010, Motorola, Inc. All rights reserved except as otherwise explicitly indicated. The information offered in this article is offered on an AS IS basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either expressed or implied. In addition, Motorola disclaims all liability from the use or inability to use the information provided. The entire risk as to the quality and performance of the information in this article is with you. The publication may contain certain you sample code in the form of example applications and code fragments. Motorola grants you a limited personal, non-exclusive, and revocable license to: (i) use the sample source code internally to develop, test, evaluate and demonstrate software applications for use y p, , pp solely with or on Motorola wireless handset products, and (ii) incorporate the sample source code into the applications and distribute the applications in binary form only, provided that you include any copyright notice that appears in the sample source code.

Android Developer Competition

License
Licensed under th A Li d d the Apache Li h License, V i 2 0 (th Li Version 2.0 (the License); you may not use thi fil except ) t this file t in compliance with the license. You may obtain a copy of the license at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing software distributed under the License is writing, distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied. See the License for the specific language governing permissions and limitations under the License.

Android Developer Competition