WorkshopAndroid<br />Presented by<br />Arno den Hond<br />Jorik Bremer<br />Holland9.com<br />
Introduction<br />Android in one afternoon<br />Understanding Android technology and being Eric Schmidt<br />Arno den Hond...
Workshop Outline<br />13.00 - 13.15: Android introduction<br />History, facts and trends<br />13.15 - 13.35: Android Atono...
Android Introduction<br />Holland9.com<br />
Google why Android?<br />Carrier Adoptation but…<br />It’s free everybody …<br />Targeting<br />Security<br />Distribution...
Some facts and figures<br />Open Handset Alliance<br />Markets and devices<br />Developers ecosystem<br />Holland9.com<br />
Android Anatomy<br />What is Android? (and what not?)<br />Is it Java? Difference with iPhone?<br />Component Mash-up<br /...
SQLite, XML, Preferences Framework
Location and Maps</li></ul>Holland9.com<br />
What is Android<br /><ul><li>Not hardware but a software platform
Java syntax but different compiler and virtual machine
Android Library and Google Libraries
NDK
Open source platform, closed source apps</li></ul>Holland9.com<br />
Component Mash-Up<br /><ul><li>UI Component: Activity
Intents to start Activities
ContentProviders to expose data
BroadcastReceivers to receive messages
Services in the background
Permissions
APK resources</li></ul>Holland9.com<br />
User Interface<br /><ul><li>Activity Lifecycle
XML Definition
Screen Layouts
Widget Components
Event Listeners
Pop-up Menu
Externalized values
Localization
Themes
Graphics
Animations</li></ul>Holland9.com<br />
XML Definition<br /><ul><li>Activity Lifecycle
XML Definition
Screen Layouts
Widget Components
Event Listeners
Upcoming SlideShare
Loading in...5
×

Holland9 Android Workshop Hogeschool Rotterdam

3,351

Published on

Slides used at Holland9 Android Workshop Hogeschool Rotterdam.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
3,351
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • -
  • Recommended hardware requirementsGoogle apps (gmail, market, youtube) closed sourceGoogle libraries (maps) not part of Android core
  • An “app” is a package of 4 types of components.Activity, Service, Content Provider, Broadcast ReceiverA package can have 0 .. n “launchable” ActivitiesActivity in package A can call Activity in package BContent Provider identified by URL, accessed like databaseIntent starts one Activity, Broadcast can start multiple receiversCreate your own permissions which other apps must request
  • XML is a struggle at firstXML makes code less britleProgrammatic UI composing is possibleComplete widget setCustom WidgetsEvents: Click, Input, Focus, SelectionList and ExpandableListSpecialized ActivitiesMenu XML definitionToast is an auto-dismissing dialogExternalized values leaves cleaner codeEasy localization all in 1 appDrawing onto Canvas with PaintOpenGL 3DAnimations by frames or (scriptable) tweens
  • XML is a struggle at firstXML makes code less britleProgrammatic UI composing is possibleComplete widget setCustom WidgetsEvents: Click, Input, Focus, SelectionList and ExpandableListSpecialized ActivitiesMenu XML definitionToast is an auto-dismissing dialogExternalized values leaves cleaner codeEasy localization all in 1 appDrawing onto Canvas with PaintOpenGL 3DAnimations by frames or (scriptable) tweens
  • XML is a struggle at firstXML makes code less britleProgrammatic UI composing is possibleComplete widget setCustom WidgetsEvents: Click, Input, Focus, SelectionList and ExpandableListSpecialized ActivitiesMenu XML definitionToast is an auto-dismissing dialogExternalized values leaves cleaner codeEasy localization all in 1 appDrawing onto Canvas with PaintOpenGL 3DAnimations by frames or (scriptable) tweens
  • XML is a struggle at firstXML makes code less britleProgrammatic UI composing is possibleComplete widget setCustom WidgetsEvents: Click, Input, Focus, SelectionList and ExpandableListSpecialized ActivitiesMenu XML definitionToast is an auto-dismissing dialogExternalized values leaves cleaner codeEasy localization all in 1 appDrawing onto Canvas with PaintOpenGL 3DAnimations by frames or (scriptable) tweens
  • XML is a struggle at firstXML makes code less britleProgrammatic UI composing is possibleComplete widget setCustom WidgetsEvents: Click, Input, Focus, SelectionList and ExpandableListSpecialized ActivitiesMenu XML definitionToast is an auto-dismissing dialogExternalized values leaves cleaner codeEasy localization all in 1 appDrawing onto Canvas with PaintOpenGL 3DAnimations by frames or (scriptable) tweens
  • XML is a struggle at firstXML makes code less britleProgrammatic UI composing is possibleComplete widget setCustom WidgetsEvents: Click, Input, Focus, SelectionList and ExpandableListSpecialized ActivitiesMenu XML definitionToast is an auto-dismissing dialogExternalized values leaves cleaner codeEasy localization all in 1 appDrawing onto Canvas with PaintOpenGL 3DAnimations by frames or (scriptable) tweens
  • SQLite full fledged DBCursorsCursor AdaptersAdapter ViewsShareable through content provider to ensure consitencyResources (read only)Array valuesAssetsPackaged Data filesPreferencesEasy storage of settingsPreference screensXml definitionFilesRead/Write whateverRequires permission
  • SQLite full fledged DBCursorsCursor AdaptersAdapter ViewsShareable through content provider to ensure consitencyResources (read only)Array valuesAssetsPackaged Data filesPreferencesEasy storage of settingsPreference screensXml definitionFilesRead/Write whateverRequires permission
  • SQLite full fledged DBCursorsCursor AdaptersAdapter ViewsShareable through content provider to ensure consitencyResources (read only)Array valuesAssetsPackaged Data filesPreferencesEasy storage of settingsPreference screensXml definitionFilesRead/Write whateverRequires permission
  • SQLite full fledged DBCursorsCursor AdaptersAdapter ViewsShareable through content provider to ensure consitencyResources (read only)Array valuesAssetsPackaged Data filesPreferencesEasy storage of settingsPreference screensXml definitionFilesRead/Write whateverRequires permission
  • Holland9 Android Workshop Hogeschool Rotterdam

    1. 1. WorkshopAndroid<br />Presented by<br />Arno den Hond<br />Jorik Bremer<br />Holland9.com<br />
    2. 2. Introduction<br />Android in one afternoon<br />Understanding Android technology and being Eric Schmidt<br />Arno den Hond: Android technical developer<br />Jorik Bremer: Android business consultant<br />Holland9.com<br />
    3. 3. Workshop Outline<br />13.00 - 13.15: Android introduction<br />History, facts and trends<br />13.15 - 13.35: Android Atonomy<br />Introduction into GUI framework<br />13.35 - 14.15: Doing Android Part 1<br />Making app with dialer, GPS and browser<br />10 MINUTE BREAK<br />14.25 – 15.45: Doing Android Part 2<br />Making app with dialer, GPS and browser<br />10 MINUTE BREAK<br />15.55 - 16.30: The future of Android<br />Android Business Case<br />Holland9.com<br />
    4. 4. Android Introduction<br />Holland9.com<br />
    5. 5. Google why Android?<br />Carrier Adoptation but…<br />It’s free everybody …<br />Targeting<br />Security<br />Distribution channels<br />Holland9.com<br />
    6. 6. Some facts and figures<br />Open Handset Alliance<br />Markets and devices<br />Developers ecosystem<br />Holland9.com<br />
    7. 7. Android Anatomy<br />What is Android? (and what not?)<br />Is it Java? Difference with iPhone?<br />Component Mash-up<br />Activity, Content Provider, Broadcast, Service<br />User Interface<br />XML, Layout, Widgets<br /><ul><li>Data Storage
    8. 8. SQLite, XML, Preferences Framework
    9. 9. Location and Maps</li></ul>Holland9.com<br />
    10. 10. What is Android<br /><ul><li>Not hardware but a software platform
    11. 11. Java syntax but different compiler and virtual machine
    12. 12. Android Library and Google Libraries
    13. 13. NDK
    14. 14. Open source platform, closed source apps</li></ul>Holland9.com<br />
    15. 15. Component Mash-Up<br /><ul><li>UI Component: Activity
    16. 16. Intents to start Activities
    17. 17. ContentProviders to expose data
    18. 18. BroadcastReceivers to receive messages
    19. 19. Services in the background
    20. 20. Permissions
    21. 21. APK resources</li></ul>Holland9.com<br />
    22. 22. User Interface<br /><ul><li>Activity Lifecycle
    23. 23. XML Definition
    24. 24. Screen Layouts
    25. 25. Widget Components
    26. 26. Event Listeners
    27. 27. Pop-up Menu
    28. 28. Externalized values
    29. 29. Localization
    30. 30. Themes
    31. 31. Graphics
    32. 32. Animations</li></ul>Holland9.com<br />
    33. 33. XML Definition<br /><ul><li>Activity Lifecycle
    34. 34. XML Definition
    35. 35. Screen Layouts
    36. 36. Widget Components
    37. 37. Event Listeners
    38. 38. Pop-up Menu
    39. 39. Externalized values
    40. 40. Localization
    41. 41. Themes
    42. 42. Graphics
    43. 43. Animations</li></ul>Mark-up style definition<br />Separates code from design<br />Eclipse designer<br />Device customization<br />Holland9.com<br />
    44. 44. Screen Layouts<br /><ul><li>Activity Lifecycle
    45. 45. XML Definition
    46. 46. Screen Layouts
    47. 47. Widget Components
    48. 48. Event Listeners
    49. 49. Pop-up Menu
    50. 50. Externalized values
    51. 51. Localization
    52. 52. Themes
    53. 53. Graphics
    54. 54. Animations</li></ul>FrameLayout<br />LinearLayout<br />TableLayout<br />RelativeLayout<br />ScrollView<br />Holland9.com<br />
    55. 55. Widget Components<br /><ul><li>Activity Lifecycle
    56. 56. XML Definition
    57. 57. Screen Layouts
    58. 58. Widget Components
    59. 59. Event Listeners
    60. 60. Pop-up Menu
    61. 61. Externalized values
    62. 62. Localization
    63. 63. Themes
    64. 64. Graphics
    65. 65. Animations</li></ul>Buttons<br />Options<br />Input<br />Lists<br />Custom Views<br />Holland9.com<br />
    66. 66. Intent<br /><ul><li>Matching
    67. 67. Urls
    68. 68. Broadcasts</li></ul>Holland9.com<br />
    69. 69. Notifications<br /><ul><li>Dialog
    70. 70. Toast
    71. 71. Notification Manager
    72. 72. Alarm Manager</li></ul>Holland9.com<br />
    73. 73. Data Storage<br /><ul><li>SQLite
    74. 74. Resources
    75. 75. Assets
    76. 76. Preferences
    77. 77. Files
    78. 78. Adapter Views</li></ul>Holland9.com<br />
    79. 79. Location and Maps<br /><ul><li>Location Providers
    80. 80. Network, Wifi, GPS
    81. 81. Criteria
    82. 82. Power, Accuracy, Cost
    83. 83. Location methods
    84. 84. Bearing, distance
    85. 85. Google Maps Api
    86. 86. Api Key
    87. 87. Overlays
    88. 88. Push pins</li></ul>Holland9.com<br />
    89. 89. Webview<br /><ul><li>View component
    90. 90. Link destination
    91. 91. Javascript interaction</li></ul>Holland9.com<br />
    92. 92. Peripherals<br /><ul><li>Camera/ Display
    93. 93. Tilt / Accelerometer
    94. 94. Magnetic compass
    95. 95. GPS
    96. 96. Microphone / Speaker
    97. 97. Keyboard
    98. 98. Trackball / D-Pad
    99. 99. 3G / Wi-Fi / Bluetooth</li></ul>Holland9.com<br />
    100. 100. Summary<br /><ul><li>Components
    101. 101. Activities & Intents
    102. 102. User Interface
    103. 103. Notifications
    104. 104. Data Storage
    105. 105. Location
    106. 106. Map
    107. 107. WebView</li></ul>Holland9.com<br />
    108. 108. Hands on<br /><ul><li>Eclipse ADT
    109. 109. Emulator
    110. 110. Create Activity
    111. 111. Create Button
    112. 112. Start Intent
    113. 113. Use Location Manager
    114. 114. Show MapView</li></ul>Holland9.com<br />
    115. 115. ADT & Emulator<br /><ul><li>Help > Install new software (3.5 Galileo)
    116. 116. Help > Software updates (3.4 Ganymede)
    117. 117. SDK / AVD manager
    118. 118. Create new virtual device with Google API
    119. 119. Start device
    120. 120. http://developer.android.com/sdk/eclipse-adt.html</li></ul>Holland9.com<br />
    121. 121. Create Activity<br /><ul><li>File > New > Other > Android Project
    122. 122. Define Project, App, Package, Activity Name
    123. 123. Build Target: Google APIs
    124. 124. Run “Hello World” in emulator.
    125. 125. http://developer.android.com/resources/tutorials/hello-world.html</li></ul>Holland9.com<br />
    126. 126. Create Button Layout<br /><ul><li>Open root eslayoutmain.xml
    127. 127. Select LinearLayout in Outline view.
    128. 128. In Properties view set Orientation field to “vertical”.
    129. 129. Add Button widget to LinearLayout
    130. 130. In Properties view set Id to “@+id/mybutton”
    131. 131. Verify generated XML in “main.xml” tab page
    132. 132. Open rootsrcmypackagemyactivity.java
    133. 133. http://developer.android.com/resources/tutorials/views/index.html</li></ul>Holland9.com<br />
    134. 134. Create Button Listener<br /><ul><li>In onCreate Method, after setContentView, get a pointer to the Button
    135. 135. Button mybutton = (Button) findViewById(R.id.mybutton);
    136. 136. Add click listener to button using its setOnClickListener() method.
    137. 137. Add OnClickListener interface to Activity.
    138. 138. Add unimplemented onClick(View v) method.
    139. 139. http://developer.android.com/guide/topics/ui/ui-events.html</li></ul>Holland9.com<br />
    140. 140. Start Intent<br /><ul><li>In onClick method, create a new Intent object.
    141. 141. String action = Intent.ACTION_DIAL
    142. 142. Uri uri = Uri.parse(“tel:1234567890”)
    143. 143. In onClick method, call startActivity(myIntent);
    144. 144. Run in emulator
    145. 145. Try Intent.ACTION_VIEW and “http://server”
    146. 146. http://developer.android.com/guide/topics/intents/intents-filters.html</li></ul>Holland9.com<br />
    147. 147. Create your own Intent<br /><ul><li>Create another Activity sub-class.
    148. 148. Open rootAndroidManifest.xml
    149. 149. Within the application tag, create an activity tag. Set the android:name attribute to the new Activity class. Nest an intent-filter tag. Nest an action tag (attribute name to whatever) and a category tag (attribute name to android.intent.category.DEFAULT)
    150. 150. In onClick method, call the whatever action without an Uri.</li></ul>Holland9.com<br />
    151. 151. LocationManager<br /><ul><li>In manifest.xml, add 2 permissions.
    152. 152. Within the manifest tag, create 2 uses-permission tag. Set the android:name attributes to android.permission.ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION.
    153. 153. In Activity’s onCreate method, get a pointer to LocationManager using getSystemService Method with Context.LOCATION_SERVICE parameter. Cast result to LocationManager.</li></ul>Holland9.com<br />
    154. 154. Criteria and Location<br /><ul><li>Create a criteria object and setAccuracy to Criteria.ACCURACY_FINE
    155. 155. Get a location provider by calling the LocationManager’sgetBestProvider method with the criteria parameter and a boolean to return only enabled providers.
    156. 156. Use LocationManagersgetLastKnownLocation method with the provider parameter to get a Location object.</li></ul>Holland9.com<br />
    157. 157. Displaying the location<br /><ul><li>Similar to the buttons, now add 2 TextView widgets to the layout. Name them @+id/latitude and @+id/longitude
    158. 158. Using findViewById, get pointers to the TextViews.
    159. 159. Use Location’s getLatitude and getLongitude methods to get values.
    160. 160. Use TextView’ssetText method to set values into UI.</li></ul>Holland9.com<br />
    161. 161. Manipulating the Emulator<br /><ul><li>Connect telnet client to localhost on port 5554
    162. 162. Use command “geo fix 5 52” to set location.
    163. 163. Longitude (angle from Greenwich meridian) first, then latitude (angle from Equator)
    164. 164. Negative values for western and southern hemisphere.
    165. 165. Create a button and listener to refresh the UI
    166. 166. http://developer.android.com/guide/developing/tools/emulator.html</li></ul>Holland9.com<br />
    167. 167. MapView UI<br /><ul><li>Create a new “Android XML file”
    168. 168. Select type Layout and root element FrameLayout.
    169. 169. ADT does not support MapView so add it manually to XML:</li></ul>&lt;com.google.android.maps.MapView<br />android:id=“@+id/mapview”<br />android:layout_width=“fill_parent”<br />android:layout_height=“fill_parent”<br />android:clickable=“true”/&gt;<br />Holland9.com<br />
    170. 170. Certificate Fingerprint and Maps Key<br /><ul><li>Locate your debug keystore in Eclipse configuration
    171. 171. From command prompt, at keystore location use “keytool -list -alias androiddebugkey -keystoredebug.keystore” to get fingerprint.
    172. 172. Passwords: android
    173. 173. http://code.google.com/android/maps-api-signup.html
    174. 174. Add android:apiKey=“mykey” attribute to MapView tag in layout xml.</li></ul>Holland9.com<br />
    175. 175. Preparing the map<br /><ul><li>Add a uses-library tag inside the application tag. Set tag attribute android:name to com.google.android.maps
    176. 176. Add a uses-permission tag inside the manifest tag. Set tag attribute android:name to android.permission.INTERNET
    177. 177. Create a subclass of MapActivity and set the layout containing the mapview like before.
    178. 178. Get a pointer to the mapview as before and call setBuiltInZoomControls(true)</li></ul>Holland9.com<br />
    179. 179. Creating the overlay<br /><ul><li>Create a class to extend ItemizedOverlay<OverlayItem>
    180. 180. createItem(inti) method returns a GeoPoint wrapped in an OverlayItem.
    181. 181. Call the Overlay’s populate method after updating the Item
    182. 182. Add your ItemizedOverlay subclass to the MapView’s overlays.
    183. 183. http://developer.android.com/resources/tutorials/views/hello-mapview.html</li></ul>Holland9.com<br />
    184. 184. Testing / Debugging<br /><ul><li>Try to run it in the emulator.
    185. 185. In system settings, turn on a location provider
    186. 186. Add a refresh button and see the marker move after manipulating the location.
    187. 187. Use Logcat view to show debug info.
    188. 188. http://developer.android.com/guide/index.html</li></ul>Holland9.com<br />
    189. 189. Being Eric Schmidt<br /><ul><li>Now you decide ……..</li></ul>Holland9.com<br />

    ×