Mobile without Linux is like Forest without birds SOMS Lecture Series 02
Getting started with Google Android M Qasim Ali President, SOMS June 25 th  2009
Agenda <ul><li>Android platform  </li></ul><ul><li>Development tools  </li></ul><ul><li>Android programming  </li></ul>
What is Android? <ul><li>“ Android is a software stack for mobile devices that includes an operating system, middleware an...
Android applications <ul><li>are written in the Java language </li></ul><ul><li>run on the Dalvik virtual machine </li></ul>
Dalvik VM <ul><li>not a Java VM </li></ul><ul><li>design constraints: slow CPU, little RAM </li></ul><ul><li>will run on O...
Getting started
Development tools <ul><li>Android SDK </li></ul><ul><li>Eclipse plugin </li></ul>
Android SDK <ul><li>Android emulator </li></ul><ul><li>command line tools </li></ul><ul><li>documentation </li></ul><ul><l...
Android emulator
Command line tools <ul><li>aapt  - Android asset packaging tool </li></ul><ul><li>adb  - Android debug bridge </li></ul><u...
Emulator limitations <ul><li>No support for placing or receiving actual phone </li></ul><ul><li>calls </li></ul><ul><li>No...
Eclipse plugin
Android applications <ul><li>application package file:  myapp.apk </li></ul><ul><li>an application is composed of one or m...
Activity <ul><li>an activity is usually a single screen in your application </li></ul><ul><li>however, activities can also...
android.app.Activity import android.app.Activity; public class MyActivity extends Activity{ public void onCreate(Bundle sa...
 
Application  Building blocks <ul><li>AndroidManifest.xml </li></ul><ul><li>Activities </li></ul><ul><li>Views </li></ul><u...
App main User Interface Will create app layout according to the xml description:  main.xml
Source code  Layout  Resource file: aapt tool App’s source code App’s package Android Project Android built in packages – ...
Manifest file AndroidManifest.xml Apps behavior in Android system
Implementing your application UI <ul><li>Java code </li></ul><ul><li>XML </li></ul>
Android UI: XML App main User Interface
Android UI: Views <ul><li>an object that knows how to draw itself on the screen </li></ul><ul><li>examples: </li></ul><ul>...
< TextView > < LinearLayout >
Intents <ul><li>“ an Intent is a simple message object that represents an ‘intention’ to do something” </li></ul><ul><li>“...
android.content.Intent <ul><li>VIEW_ACTION </li></ul><ul><li>EDIT_ACTION </li></ul><ul><li>PICK_ACTION </li></ul><ul><li>W...
Application Context <ul><li>android.app.ApplicationContext </li></ul><ul><ul><li>startActivity(Intent) </li></ul></ul><ul>...
Additional topics <ul><li>Threading </li></ul><ul><li>Security model </li></ul><ul><li>Internationalization </li></ul><ul>...
Additional Resources  <ul><li>http://code.google.com/android/ </li></ul><ul><li>http://android-developers.blogspot.com </l...
Application vs. Activity <ul><li>An application can be composed of multiple Activities, but one application must have at l...
Application: Hello Android!
Source code  Layout  Resource file: aapt tool App’s source code App’s package Android Project Android built in packages – ...
App main User Interface Resource delimitations  Apps behavior in Android system
Apps behavior in Android system  App’s source code
 
public non-public We are writing a function that is present in parent class Activity as  PROTECTED  member inherited derived
public non-public: protected inherited derived Activity HelloAndroid Public: OnCreate() inherited derived keyword:  super ...
App main User Interface Will create app layout according to the xml description:  main.xml
< TextView > < LinearLayout >
Upcoming SlideShare
Loading in …5
×

Getting Started With Android

5,614 views
5,515 views

Published on

Published in: Technology, Education

Getting Started With Android

  1. 1. Mobile without Linux is like Forest without birds SOMS Lecture Series 02
  2. 2. Getting started with Google Android M Qasim Ali President, SOMS June 25 th 2009
  3. 3. Agenda <ul><li>Android platform </li></ul><ul><li>Development tools </li></ul><ul><li>Android programming </li></ul>
  4. 4. What is Android? <ul><li>“ Android is a software stack for mobile devices that includes an operating system, middleware and key applications” </li></ul>
  5. 5. Android applications <ul><li>are written in the Java language </li></ul><ul><li>run on the Dalvik virtual machine </li></ul>
  6. 6. Dalvik VM <ul><li>not a Java VM </li></ul><ul><li>design constraints: slow CPU, little RAM </li></ul><ul><li>will run on OS without swap space </li></ul><ul><li>http://sites.google.com/site/io/dalvik-vm-internals </li></ul>
  7. 7. Getting started
  8. 8. Development tools <ul><li>Android SDK </li></ul><ul><li>Eclipse plugin </li></ul>
  9. 9. Android SDK <ul><li>Android emulator </li></ul><ul><li>command line tools </li></ul><ul><li>documentation </li></ul><ul><li>example applications </li></ul>
  10. 10. Android emulator
  11. 11. Command line tools <ul><li>aapt - Android asset packaging tool </li></ul><ul><li>adb - Android debug bridge </li></ul><ul><li>aidl - Android IDL compiler </li></ul><ul><li>emulator - Android emulator </li></ul>
  12. 12. Emulator limitations <ul><li>No support for placing or receiving actual phone </li></ul><ul><li>calls </li></ul><ul><li>No support for camera/video capture (input) </li></ul><ul><li>No support for audio input </li></ul><ul><li>No support for determining connected state </li></ul><ul><li>No support for determining battery charge level </li></ul><ul><li>No support for Bluetooth </li></ul>
  13. 13. Eclipse plugin
  14. 14. Android applications <ul><li>application package file: myapp.apk </li></ul><ul><li>an application is composed of one or more activities </li></ul>
  15. 15. Activity <ul><li>an activity is usually a single screen in your application </li></ul><ul><li>however, activities can also be faceless </li></ul><ul><li>one activity is designated as the entry point for your application </li></ul>
  16. 16. android.app.Activity import android.app.Activity; public class MyActivity extends Activity{ public void onCreate(Bundle savedValues){ super.onCreate(savedValues); setContentView(R.layout.main); } }
  17. 18. Application Building blocks <ul><li>AndroidManifest.xml </li></ul><ul><li>Activities </li></ul><ul><li>Views </li></ul><ul><li>Layouts </li></ul><ul><li>Intents & IntentReceivers </li></ul><ul><li>Services </li></ul><ul><li>Notifications </li></ul><ul><li>ContentProviders </li></ul>
  18. 19. App main User Interface Will create app layout according to the xml description: main.xml
  19. 20. Source code Layout Resource file: aapt tool App’s source code App’s package Android Project Android built in packages – Wifi, GSM, other sensors Apps behavior in Android system App main User Interface Resource delimitations
  20. 21. Manifest file AndroidManifest.xml Apps behavior in Android system
  21. 22. Implementing your application UI <ul><li>Java code </li></ul><ul><li>XML </li></ul>
  22. 23. Android UI: XML App main User Interface
  23. 24. Android UI: Views <ul><li>an object that knows how to draw itself on the screen </li></ul><ul><li>examples: </li></ul><ul><ul><li>android.widget.ListView </li></ul></ul><ul><ul><li>android.widget.DatePicker </li></ul></ul><ul><ul><li>android.widget.Button </li></ul></ul><ul><ul><li>android.widget.ImageView </li></ul></ul>
  24. 25. < TextView > < LinearLayout >
  25. 26. Intents <ul><li>“ an Intent is a simple message object that represents an ‘intention’ to do something” </li></ul><ul><li>“ an intent is an abstract description of an operation to be performed” </li></ul>
  26. 27. android.content.Intent <ul><li>VIEW_ACTION </li></ul><ul><li>EDIT_ACTION </li></ul><ul><li>PICK_ACTION </li></ul><ul><li>WEB_SEARCH_ACTION </li></ul><ul><li>SYNC_ACTION </li></ul><ul><li>... </li></ul>
  27. 28. Application Context <ul><li>android.app.ApplicationContext </li></ul><ul><ul><li>startActivity(Intent) </li></ul></ul><ul><ul><li>getSystemService </li></ul></ul><ul><ul><li>createDatabase </li></ul></ul><ul><ul><li>openDatabase </li></ul></ul><ul><ul><li>deleteDatabase </li></ul></ul><ul><ul><li>... </li></ul></ul>
  28. 29. Additional topics <ul><li>Threading </li></ul><ul><li>Security model </li></ul><ul><li>Internationalization </li></ul><ul><li>Power management </li></ul><ul><li>AIDL - Android IDL </li></ul><ul><li>Data synchronization </li></ul><ul><li>API for WiFi </li></ul>
  29. 30. Additional Resources <ul><li>http://code.google.com/android/ </li></ul><ul><li>http://android-developers.blogspot.com </li></ul><ul><li>http://code.google.com/p/apps-for-android/ </li></ul><ul><li>http://sites.google.com/site/io/ </li></ul><ul><li>http://www.openhandsetalliance.com/ </li></ul><ul><li>http://git.android.com </li></ul>
  30. 31. Application vs. Activity <ul><li>An application can be composed of multiple Activities, but one application must have at least one Activity. </li></ul><ul><li>Each “window” or screen of your application is a separate Activity. </li></ul>
  31. 32. Application: Hello Android!
  32. 33. Source code Layout Resource file: aapt tool App’s source code App’s package Android Project Android built in packages – Wifi, GSM, other sensors Apps behavior in Android system App main User Interface Resource delimitations
  33. 34. App main User Interface Resource delimitations Apps behavior in Android system
  34. 35. Apps behavior in Android system App’s source code
  35. 37. public non-public We are writing a function that is present in parent class Activity as PROTECTED member inherited derived
  36. 38. public non-public: protected inherited derived Activity HelloAndroid Public: OnCreate() inherited derived keyword: super refers to the data member inherited from the base class Protected: OnCreate() super.OnCreate()
  37. 39. App main User Interface Will create app layout according to the xml description: main.xml
  38. 40. < TextView > < LinearLayout >

×