android application development introduction€¦ · android application development introduction...

32
Android Application Development Introduction August 2, 2010 Presented By W. David Taylor

Upload: others

Post on 26-Aug-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Thanks for Attending!