Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Learn how to develop for Android, beyond the Hello World android app - Cape Town Android Meetup

1,645 views

Published on

Learn the core Android App development concepts beyond creating the Android App. We used the Yamba app from the Learning Android demonstrate the use of Android Activities, Services, Broadcast Receivers, Intents and Content Providers.

Published in: Technology
  • Be the first to comment

Learn how to develop for Android, beyond the Hello World android app - Cape Town Android Meetup

  1. 1. Android App Development Beyond The HelloWorld App Cape Town Android Meetup Joseph Kandi Peruzal Android App Development Training Team www.peruzal.co.za
  2. 2. Take Aways ! Android Development Environment Android Application Components Threads in Android Designing Android UIs in XML Using Intents Performing Web Service Calls
  3. 3. Android Development Environment • • • Java Eclipse | Android Studio Android SDK
  4. 4. Java Skill Level • • • • • • • • Variables • Operators String Loops Methods Class Static Inheritance • • • • • • Packages and Import Access Levels Constants Interface • • • • Casting • Boxing and UnBoxing Inheritance Abstract Generics Threads Enum Exception Handling
  5. 5. Android and Java
  6. 6. Android Software Stack Content Providers, Activity anager, Window Manager,View System, Notification System, Telephony Home, Contacts, Browser, Yamba SQLite, WebKit, SSL, OpenGL ES, Media Framework Custom Linux 2.6 kernel
  7. 7. Inside Android Use command adb shell to logon to the device sdcard System partition Note the permissions on the folders
  8. 8. Android Versions and API Level
  9. 9. Get Java http://www.oracle.com/technetwork/java/javase/downloads/jdk7downloads-1880260.html
  10. 10. Eclipse http://developer.android.com/sdk/index.html Download from this link
  11. 11. Android Studio Still buggy, not ideal for beginners to Android development Download from here
  12. 12. Building Blocks Activities Services Content Providers Broadcast Receivers Application
  13. 13. Activity An activity is a single, focused thing that the user can do.
  14. 14. Activity Life Cycle
  15. 15. Activity Class Called when the activity will start interacting with the user Called the activity is first created Called when the activity is becoming visible to the user Called when the system is about to start resuming a previous activity Final call before the activity is destroyed Called after the activity has been stopped, prior to it being started again Called when activity is no longer visible
  16. 16. Intents Messages sent among the major building blocks. They trigger an action to start up, tell a service to start or stop, or simple broadcast
  17. 17. Services Services run in the background and don’t have a user interface components
  18. 18. Content Providers Interfaces for sharing data
  19. 19. Broadcast Receivers Android implementation of publish/subscribe mechanism or the Observer pattern
  20. 20. Application Context Refers to the application environment and the process within which all the components are running ! Used to share data between components Context.getApplicationContext Activity.getApplication
  21. 21. Android User Interface Java - done in code XML - declarative
  22. 22. Views Android organizes its UI into layout and views
  23. 23. Write the xml Load the XML Resource
  24. 24. Layouts
  25. 25. Example Linear Layout Also called match_parent Either
  26. 26. Relative Example
  27. 27. Creating a New Project • Walkthrough, create a new project
  28. 28. Choose New Project
  29. 29. Project Name - NB No spaces allowed The name of the app Package name, usually reverse dns of your company name Minimum supported SDK the app will run on The version of Android we are building for Does not do anything, ignore Create an initial activity
  30. 30. Customize the launcher Path for the image used as a launch icon on the home screen Preview of the launch icon on different screen resolutions
  31. 31. Choose “Blank Activity” here Choose Activity Type Choose different activity types
  32. 32. Choose Main Activity Name Leave it as MainActivity for now, in future we will change it The xml file defining the user interface for our activity Leave as is
  33. 33. Project Structure Main activity created during project setup Resource folders go under “res” folder xml layout file defining the screen for the app Explains what application consists, the main building blocks, permissions
  34. 34. AndroidMainfest.xml Package name for the application Android SDK Main activity action Activity declaration Intent Category of the action
  35. 35. Layout xml Live preview xml defining the UI File lives under “layout” resource folder
  36. 36. Main Activity xml file Layout container xml properties View component
  37. 37. Java file Extends Activity class Using the class R to point to the layout
  38. 38. R file | Auto-generated R.layout.activity_main, referring to the file under /layout/activity_main.xml
  39. 39. strings.xml Value Key used to retrieve the string
  40. 40. AVD | Android Virtual Device Launch AVD manager Launch AVD manager
  41. 41. AVD Manager AVD images Available devices, need at least one to test the app Add a new AVD
  42. 42. Create a New AVD Choose name, no spaces allowed Choose device specifications Camera support Amount of RAM Improves speed of the emulator Android SDK version
  43. 43. User Interface and Controls • Project Overview
  44. 44. Project Overview Yamba App Context Status Activity post status update Twitter Service 1
  45. 45. Status Activity
  46. 46. Timeline Activity
  47. 47. Action Bar | Menu
  48. 48. Preferences

×