Android Application Development Introduction€¦ · Android Application Development Introduction...
Transcript of Android Application Development Introduction€¦ · Android Application Development Introduction...
![Page 1: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/1.jpg)
Android Application Development Introduction
August 2, 2010
Presented By W. David Taylor
![Page 2: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/2.jpg)
Part 1 - Intro To Android
![Page 3: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/3.jpg)
What is Android Exactly?
Android is a software stack for mobile devices that includes an operating system (linux), middleware and key applications. The Android SDK provides the tools and APIs necessary to begin
developing applications on the Android platform using the Java programming language.
![Page 4: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/4.jpg)
API Highlights
The Android API provides access to hardware resources
● Camera● GPS● Accelerometer● Compass● SD Card File System
![Page 5: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/5.jpg)
API Highlights (cont.)
The Android API provides access to Software Resources
● Google Maps● Geocoding● Location Based Services● Media Player● Phone Dialer
![Page 6: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/6.jpg)
API Highlights (cont.)
The Android API sports many advanced programming features
● Background Services● SQLite Database for Data Storage and Retrieval.● Shared Data and Interapplication Communications
![Page 7: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/7.jpg)
Application Architecture
The Android application architecture encourages component reuse of activities, services, data with other applications
● Activity Manager – Manages the life cycle of activities● Views – Used to construct user interfaces (buttons, textviews,
etc.)● Notification Manager – Mechanism to signal users● Content Providers – Used to share you application's data● Resource Manager – Used to manage non-source resources
like strings and graphics
![Page 8: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/8.jpg)
Dalvik Virtual Machine
Each Android application runs in it's own instance of the Dalvik Virtual Machines (named after a fishing village in Iceland).
The Dalvik VM is a register-based VM that's been optimized to ensure that a device can run multiple instances efficiently.
![Page 9: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/9.jpg)
Programming Environment
The Android SDK (Software Development Kit) and AVD (Android Virtual Device) emulator are nicely integrated with Eclipse IDE.
Eclipse and Android are free and run on Linux, Windows, and Apple OS X. A Java VM is required on the Development Machine.
![Page 10: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/10.jpg)
Eclipse and Android
![Page 11: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/11.jpg)
Resources
Android employs static resource files that can be accessed from code to help streamline application development
● Drawable – used to store images and xml drawable definitions
● Layouts - used for interface design● Values – used to store strings and other
variable values
![Page 12: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/12.jpg)
Layout Types
Android supports the following layout types
● FrameLayout – A blank space where child objects can be arranged
● LinearLayouts - aligns all children in a single direction — vertically or horizontally
● TableLayout – positions its children into rows and columns● RelativeLayout - lets child views specify their position relative
to the parent view or to each other
![Page 13: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/13.jpg)
Linear Layout Example
Simple Linear Layout
![Page 14: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/14.jpg)
Android Activities
Activities are the application's presentation layer. Every screen extends the base Activity class. Activities use Views (controls) to build user interfaces.
![Page 15: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/15.jpg)
Part 2 – Real World Android Project
![Page 16: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/16.jpg)
Let's Look at a Real Project
To Demonstrate some of the capabilities of Android let's look at a project that I am developing. The application allows users to add notes to Goolge Maps based on user's location.
This Project uses Native GPS, Internet, and Goolge Maps.
![Page 17: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/17.jpg)
Map Crumbz (My Learning Project)
Splash Screen● Uses built in Progress Dialog
API● Uses GPS API to get actual
location● Uses a Thread to proceed to
main screen after a location fix is obtained
![Page 18: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/18.jpg)
Map Crumbz (Cont.)
Main Map Screen● Uses Google MapView API● Uses Frame Layout with child
TableView (top bar) and MapView
● Uses Drawable Resource for Map Icon
![Page 19: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/19.jpg)
Map Crumbz (Cont.)
Main Screen Menus● Uses Menu xml resources to
define menu items● Menu's are created by
overriding the onCreateOptionsMenu() Function in the Activity Class
● Menu item selections are handled by overriding the OnOptionsItemsSelection() Function in the Activity Class
![Page 20: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/20.jpg)
Map Crumbz (Cont.)
Main Screen Satellite View● Calls the Google MapView API
to switch to Satellite Background
● To Do! Make marker lighter to show up better when in Satellite View
![Page 21: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/21.jpg)
Map Crumbz (Cont.)
Enter Map Crumb● When the button is pressed
the Map Activity invokes a sub-activity and bundles data to pass in by calling the StartActivityForResult() function
● The calling Map Activity listens for a result by overriding the OnActivityResult() function
![Page 22: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/22.jpg)
Map Crumbz (Cont.)
Data Entry Screen● Uses FrameLayout with child
TableLayouts with a ScrollView
● Notice that the Lat and Lon where passed in by the Map Activity
![Page 23: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/23.jpg)
Map Crumbz (Cont.)
Geocoding the Location● Calling the Geocoding API
obtain the location's address
● Notice this returns more than one result
● Geocoding is not an exact science
● Use with caution
![Page 24: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/24.jpg)
Map Crumbz (Cont.)
Enter Crumb Data● Fill in the data fields via the
software keyboard● When the Add Crumb button
is pressed the data is added to a SQLite database table and the activity returns to the main calling Map Activity
![Page 25: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/25.jpg)
Map Crumbz (Cont.)
Mission Accomplished● Now the Map Activity shows
the Map Crumb that was just entered
● The Map Activity queries the SQLite database and adds all Map Crumbz in the database to the map
![Page 26: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/26.jpg)
Map Crumbz (Cont.)
Recalling the Data● The MapView API exposes
an onTap() function that allows you to get data for the Tapped item
● The data is displayed in a custom Dialog that raises an Intent (event) callback based on the button pressed
![Page 27: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/27.jpg)
Map Crumbz (Cont.)
Built in MapView zoom controls● The MapView allows you the option of
toggling built in zoom controls● Please Note the other Map Crumbz
on the Map
![Page 28: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/28.jpg)
Part 3 – References
![Page 29: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/29.jpg)
Current Android Books
![Page 30: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/30.jpg)
Online API Documentation
http://developer.android.com
![Page 31: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/31.jpg)
Current Devices Running Android
● Mobile Phones● Slates like the iPad● Google TV
![Page 32: Android Application Development Introduction€¦ · Android Application Development Introduction August 2, 2010 Presented By W. David Taylor. Part 1 - Intro To Android. What is Android](https://reader035.fdocuments.us/reader035/viewer/2022062507/5fdbb98c6aec595d3e18fc06/html5/thumbnails/32.jpg)
Thanks for Attending!