a lap around android part 1

16
A Lap Around Android I Ben Monro June 26, 2010 SoCalCodeCamp

Upload: ben-monro

Post on 19-May-2015

1.059 views

Category:

Technology


0 download

DESCRIPTION

A Lap Around Android I Presentation from SoCal Code Camp June 26 2010

TRANSCRIPT

Page 1: A Lap Around Android Part 1

A Lap Around Android IBen Monro

June 26, 2010SoCalCodeCamp

Page 2: A Lap Around Android Part 1

2

Overview

Platform Overview The Emulator & DDMS Hands on walk through

Activities UI Components Intents Resources Dialogs

Questions & Answers

Page 3: A Lap Around Android Part 1

3

Android: The platform

Page 4: A Lap Around Android Part 1

4

Applications in Android

Written in Java Bundled into APK packages that include:

Compiled Java code Data, files & other resources required for the application to

install & run Runs in its own isolated process & java VM. Have a manifest file that defines the way the OS Launches

& interacts with the Application. Components of an Android App:

Activities Services Broadcast Receivers Content Providers – Activated by Content Resolver Intents are Asynchronous system messages that tell the OS

when/how to do something.

Activated by “Intents”

Page 5: A Lap Around Android Part 1

5

Activities

Activities are the core of Android App UIs. Made up of Views & View Groups (aka Layouts)

Examples of Views:▪ TextView / EditText▪ ListView / GridView▪ Gallery▪ Spinner▪ Button▪ ImageView▪ DatePicker

Layouts:▪ LinearLayout▪ RelativeLayout▪ TableLayout▪ AbsoluteLayout▪ Frame Layout▪ TabHost*

Can launch other Activities, Services & Broadcast Events

Built using XML, code or Both Supports Styles, Themes, Localization etc.

Page 6: A Lap Around Android Part 1

6

Android Services

Services are processes that run in the background.

Not much unlike a windows service. Can be used to play music, communicate

with a server, perform long running processes etc.

Typically used to trigger notifications in the status bar.

Communication (IPC) can be done using AIDL – Android Interface Definition Language.

Page 7: A Lap Around Android Part 1

7

Broadcast Receivers

Receive and react to broadcast announcements from the OS

No UI, but they may trigger an Activity

Examples: Time-zone has changed Battery is low Picture has been taken User has changed a system

preference

Page 8: A Lap Around Android Part 1

8

Content Providers

Provide clean way for your application to expose its data to other applications on the device and visa versa.

Data can be stored in any way you want, Files, Preferences, SQL Lite DB or whatever other resource you need.

Content can be audio, video, images, contact information, etc.

Page 9: A Lap Around Android Part 1

9

Home Screen Widgets

A small “slice” of an application that runs on the application home screen.

Limited functionality & set of Views/Layouts can be used.

Good for displaying things like stock tickers, status updates, weather forecasts, news headlines, etc.

Allows users to see a key piece of your app, without having to leave their home screen.

Page 10: A Lap Around Android Part 1

10

Killer Development Environment

What you’ll need to create Android Apps: Java Development Kit (JDK) 6 Eclipse▪ Spring Tool Suite with Google (

http://www.springsource.com/products/springsource-google-download

)▪ Eclipse Classic 3.5 or greater will also work

Android SDK Android Development Tools (ADT) – eclipse

plug-in for Android development.

Page 11: A Lap Around Android Part 1

11

Creating an Android Project in Eclipse File New Android Project

Page 12: A Lap Around Android Part 1

12

Project Structure

• Source Code Directory• UI Layout Directory (XML) – validated by compiler w/ detailed error

messages• Application Manifest – tells OS how to interact w/ your app.• Icons / Graphics – can be bitmap or xml based• Strings / Styles / Themes

Page 13: A Lap Around Android Part 1

13

The Flow of an Activity

Page 14: A Lap Around Android Part 1

14

Demo time

Lets build a calculator!

Page 15: A Lap Around Android Part 1

15

Resources

Main Android Dev Site: http://developer.android.com

Stack overflow: http://stackoverflow.com/questions/tagged/android

Google I/O Talks: http://www.youtube.com/googledevelopers

Tutorials & Forums: http://www.anddev.org/ http://www.androidpeople.com/ http://www.androidcentral.com/

Building Android Apps with Hudson & Ant: http://www.facebook.com/note.php?note_id=499519

075367

Page 16: A Lap Around Android Part 1

16

Q&A

Rate Me on SpeakerRate:http://speakerrate.com/benmonro