Your SlideShare is downloading. ×
Android Programming made easy<br />I have always wished that my computer would be as easy to use as my telephone. My wish ...
About me – Lars Vogel <br />(Twitter: @vogella)<br />Independently active in the OpenSource Community, e.g. Eclipse and An...
The next 58 minutes<br />Android overview<br />Android Tool chain<br />Demos<br />Android Programming Constructs<br />Q&A<...
What is Android?<br />– operating system based on Linux<br />– middleware <br />– key applications <br />– set of APIs<br ...
4 Software layers<br />
Dalvik – town in iceland<br />Android Programming<br />You use the Java programming language but Android does not run Java...
Android Programming<br />You use the Java programming language but Android does not run Java Bytecode<br />
Calls<br />Uses<br />
Developer Toolchain<br />
Android Development Tools (ADT) for Eclipse<br />Not OpenSource <br />Eclipse based tooling<br /><ul><li> Provide the emu...
Wizard for creating new project
 Additional Tooling</li></li></ul><li>Emulator<br />QEMU-based ARM emulator runs same image as a device<br />Use same tool...
Your first Android app in < 60 secs<br />Timer check Application<br />
Command lineadb – Android Debugging Bridgetelnet<br />
Android programming <br />constructs <br />
Main Android programming constructs<br />Activity<br />Views<br />Intents<br />Broadcast Receiver<br />Services<br />Conte...
Activity – screen in the Android application<br />Layout – Defines UI elements and their arrangements.<br />
Life Cyle of an Activity<br />void onCreate(Bundle savedInstanceState) void onStart() void onRestart() void onResume() voi...
Noteworthy:- ADT maintains the ID‘s automatically in R.java- Resources can be defined via xml <br />
I had only the best intents....<br />
Intents<br /><ul><li> Allow modular architecture
Two types
 Explicit: Asking someone to do something
 Implicit: Asking the system who can do something </li></ul>Intent<br />
Services<br />© Lars Vogel and others, Licensed under Creative Commons by-nc-nd-3.0 (de) <br />
Services<br />Android provides a multitude of system services<br /><ul><li> NotificationService
 VibratorService
 LocationService
 AlarmService
 ....</li></ul>Access via context.getSystemService(Context.CONST);<br />You can define your own service.<br />
Broadcast Receiver – Listen to system events <br />Example: <br />BATTERY_LOW, ACTION_BOOT_COMPLETED<br />Defined statical...
Timer check ApplicationLets alert! <br />
Security<br />
Android Application requires explicit permissions, e.g. for <br /><ul><li>DB access
 Phone access
 Contacts
 Internet
 System messages</li></li></ul><li>Security is an inherent part of the system and not a layer the programmer needs to hand...
There is more....<br />
Android Connectivity<br />I can talk and hear<br />Internet (java.net, Apache HttpClient,...)<br />Bluetooth<br />Email<br...
Upcoming SlideShare
Loading in...5
×

Android Programming made easy

12,902

Published on

Overview of the Android Platform and its programming interface.

Published in: Technology

Transcript of "Android Programming made easy"

  1. 1. Android Programming made easy<br />I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone<br />- BjarneStronstrup<br />
  2. 2.
  3. 3. About me – Lars Vogel <br />(Twitter: @vogella)<br />Independently active in the OpenSource Community, e.g. Eclipse and Android<br />Working for SAP AG as Product Manager<br />Maintains http://www.vogella.de Java, Eclipse and Android related Tutorials with ~15 000 visitors per<br />Received the Eclipse Top Contributor Award 2010<br />
  4. 4. The next 58 minutes<br />Android overview<br />Android Tool chain<br />Demos<br />Android Programming Constructs<br />Q&A<br />
  5. 5. What is Android?<br />– operating system based on Linux<br />– middleware <br />– key applications <br />– set of APIs<br />Open Source <br />Developed officially by the Open Handset Alliance lead by Google<br />
  6. 6. 4 Software layers<br />
  7. 7.
  8. 8. Dalvik – town in iceland<br />Android Programming<br />You use the Java programming language but Android does not run Java Bytecode<br />Tool dx converts Java Bytecode into Dalvik Executable Code (.dex)<br />
  9. 9. Android Programming<br />You use the Java programming language but Android does not run Java Bytecode<br />
  10. 10. Calls<br />Uses<br />
  11. 11. Developer Toolchain<br />
  12. 12. Android Development Tools (ADT) for Eclipse<br />Not OpenSource <br />Eclipse based tooling<br /><ul><li> Provide the emulator
  13. 13. Wizard for creating new project
  14. 14. Additional Tooling</li></li></ul><li>Emulator<br />QEMU-based ARM emulator runs same image as a device<br />Use same toolchain to work with device or emulatorInital startup is slooooowwwwww.....<br />
  15. 15. Your first Android app in < 60 secs<br />Timer check Application<br />
  16. 16. Command lineadb – Android Debugging Bridgetelnet<br />
  17. 17. Android programming <br />constructs <br />
  18. 18. Main Android programming constructs<br />Activity<br />Views<br />Intents<br />Broadcast Receiver<br />Services<br />ContentProvider<br />
  19. 19. Activity – screen in the Android application<br />Layout – Defines UI elements and their arrangements.<br />
  20. 20. Life Cyle of an Activity<br />void onCreate(Bundle savedInstanceState) void onStart() void onRestart() void onResume() void onPause() void onStop() void onDestroy()<br />Android may destroy you!<br />
  21. 21. Noteworthy:- ADT maintains the ID‘s automatically in R.java- Resources can be defined via xml <br />
  22. 22. I had only the best intents....<br />
  23. 23. Intents<br /><ul><li> Allow modular architecture
  24. 24. Two types
  25. 25. Explicit: Asking someone to do something
  26. 26. Implicit: Asking the system who can do something </li></ul>Intent<br />
  27. 27. Services<br />© Lars Vogel and others, Licensed under Creative Commons by-nc-nd-3.0 (de) <br />
  28. 28. Services<br />Android provides a multitude of system services<br /><ul><li> NotificationService
  29. 29. VibratorService
  30. 30. LocationService
  31. 31. AlarmService
  32. 32. ....</li></ul>Access via context.getSystemService(Context.CONST);<br />You can define your own service.<br />
  33. 33. Broadcast Receiver – Listen to system events <br />Example: <br />BATTERY_LOW, ACTION_BOOT_COMPLETED<br />Defined statically in manifest or temporary via code<br />
  34. 34. Timer check ApplicationLets alert! <br />
  35. 35. Security<br />
  36. 36. Android Application requires explicit permissions, e.g. for <br /><ul><li>DB access
  37. 37. Phone access
  38. 38. Contacts
  39. 39. Internet
  40. 40. System messages</li></li></ul><li>Security is an inherent part of the system and not a layer the programmer needs to handle <br />
  41. 41. There is more....<br />
  42. 42. Android Connectivity<br />I can talk and hear<br />Internet (java.net, Apache HttpClient,...)<br />Bluetooth<br />Email<br />SMS<br />I have feelings<br />Camera API<br />Motion Detection<br />Location API (GIS)<br />Heat Sensor<br />Accelerator<br />
  43. 43. Storage<br />File System (device or SD card)<br />Preferences<br />Database (SQLightDatabase)<br />
  44. 44. Beyond Android – Google API‘s<br />
  45. 45. Performance?<br />
  46. 46. Performance Sins<br />Avoid creating objects<br />Static rules<br />Avoid to use internal setters and getter (within the same class)<br />Static final for constants<br />Learn on giants (use the libraries)<br />Details: http://developer.android.com/guide/practices/design/performance.html<br />
  47. 47. Be fast!<br />Avoid ApplicationNotResponding Error<br />Threads not allowed to modify the UI directly<br />Use handler or AsyncTask to update the UI after Thread is done<br />
  48. 48. Summary<br />Android powerful and well-designed development platform<br />Power to the developer<br />
  49. 49. Picture Credit<br /> All pictures are from http://www.sxc.hu/ to get them add the number to http://www.sxc.hu/photo/<br />Agenda 1089869<br />Dalvik 1269657<br />Software Layer / Tomatos 832159<br />616474<br />Thinking guy 324541<br />Smiling Boy 812138<br />Toolchain 1197009<br />Stopwatch http://www.sxc.hu/photo/634598<br />Timer / Watches 1062014<br />Next guy 986700<br />Sad Lady 232738<br />Funny guy 1173019<br />Waiter / Services http://www.sxc.hu/photo/157966<br />Security 695054<br />There is more 702367<br /><ul><li>Performance rabbits 786444
  50. 50. Performance snail 1181451
  51. 51. Performance Running man 377100
  52. 52. Hang-man 620961
  53. 53. Summary http://www.sxc.hu/photo/1184807
  54. 54. Question http://www.sxc.hu/photo/418215
  55. 55. Reading material http://www.sxc.hu/photo/406547
  56. 56. Thank you http://www.sxc.hu/photo/986313</li></li></ul><li>Android: Where to go from here:<br />Android Tutorial <br />http://www.vogella.de/articles/Android/article.html<br />Or Google for: ~1 rank<br />“android development tutorial”<br />
  57. 57.
  58. 58. Thank you<br />For further questions:<br />Lars.Vogel@gmail.com<br />http://www.vogella.de<br />http://www.twitter.com/vogella<br />
  59. 59. License & Acknowledgements<br />This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License<br />See http://creativecommons.org/licenses/by-nc-nd/3.0/de/deed.en_US<br />

×