Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ...

70
Building Android Applications Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Dan Morrill — Android Development Slide 1

Transcript of Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ...

Page 1: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Building Android Applications

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 1

Page 2: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Agenda

• Overview & Inspiration

• Application components

• Practical matters

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 2

Page 3: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

A Powerful Trend

Why?

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 3

Page 4: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

A Powerful TrendColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 4

Page 5: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

0

1,000,000,000

2,000,000,000

3,000,000,000

4,000,000,000

2000 2001 2002 2003 2004 2005 2006 2007

Internet and Mobile Phone Users, Worldwide

Internet users (PC-based)Mobile phone users

A Powerful TrendColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 5

Page 6: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Open Handset Alliance MembersColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 6

Page 7: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Mobile Operators

Open Handset Alliance MembersColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 7

Page 8: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Mobile Operators

Handset Manufacturers

Open Handset Alliance MembersColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 8

Page 9: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Mobile OperatorsSoftware

Handset Manufacturers

Open Handset Alliance MembersColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 9

Page 10: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Mobile Operators

Semiconductor

SoftwareHandset Manufacturers

Open Handset Alliance MembersColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 10

Page 11: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Mobile Operators

SemiconductorCommercialization

SoftwareHandset Manufacturers

Open Handset Alliance MembersColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 11

Page 12: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Linux Kernel

DisplayDriver Camera Driver Bluetooth

DriverFlash Memory

DriverBinder (IPC)

Driver

Power ManagementUSB Driver Keypad Driver WiFi Driver Audio

Drivers

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 12

Page 13: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Linux Kernel

DisplayDriver Camera Driver Bluetooth

DriverFlash Memory

DriverBinder (IPC)

Driver

Power ManagementUSB Driver Keypad Driver WiFi Driver Audio

Drivers

Libraries

FreeType

SGL SSL

SQLite

WebKit

libc

Surface Manager

OpenGL | ES

MediaFramework

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 13

Page 14: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Android Runtime

Dalvik Virtual Machine

Core Libraries

Linux Kernel

DisplayDriver Camera Driver Bluetooth

DriverFlash Memory

DriverBinder (IPC)

Driver

Power ManagementUSB Driver Keypad Driver WiFi Driver Audio

Drivers

Libraries

FreeType

SGL SSL

SQLite

WebKit

libc

Surface Manager

OpenGL | ES

MediaFramework

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 14

Page 15: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Android Runtime

Dalvik Virtual Machine

Core Libraries

Application Framework

ViewSystem

Content Providers

Resource Manager GTalk ServiceLocation

Manager

Activity Manager

Package Manager

WindowManager

TelephonyManager

NotificationManager

Linux Kernel

DisplayDriver Camera Driver Bluetooth

DriverFlash Memory

DriverBinder (IPC)

Driver

Power ManagementUSB Driver Keypad Driver WiFi Driver Audio

Drivers

Libraries

FreeType

SGL SSL

SQLite

WebKit

libc

Surface Manager

OpenGL | ES

MediaFramework

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 15

Page 16: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Android Runtime

Dalvik Virtual Machine

Core Libraries

Application Framework

ViewSystem

Content Providers

Resource Manager GTalk ServiceLocation

Manager

Activity Manager

Package Manager

WindowManager

TelephonyManager

NotificationManager

Linux Kernel

DisplayDriver Camera Driver Bluetooth

DriverFlash Memory

DriverBinder (IPC)

Driver

Power ManagementUSB Driver Keypad Driver WiFi Driver Audio

Drivers

Libraries

FreeType

SGL SSL

SQLite

WebKit

libc

Surface Manager

OpenGL | ES

MediaFramework

Applications

Home PhoneContacts Browser ...

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 16

Page 17: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Application Building Blocks

Activity UI component typically corresponding to one screen.

IntentReceiver Set and respond to notifications or status changes. Can wake up your app.

Service Faceless task that runs in the background.

ContentProvider Enable applications to share data.

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 17

Page 18: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Emulator

• QEMU-based ARM emulator runs same system image as a device

• Use same toolchain to work with devices or emulator

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 18

Page 19: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Eclipse PluginProject template

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 19

Page 20: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Debugging

Call stack

Breakpoints, single stepping

Examine variables

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 20

Page 21: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 21

Page 22: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Industry

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 22

Page 23: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Industry

•Software stack open-sourced under Apache 2.0 license•Source available after first handsets ship•Anyone will be able to build a system image

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 23

Page 24: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Industry

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 24

Page 25: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Industry Users

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 25

Page 26: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

•Users have control of their experience•They control what gets installed•They choose the defaults

Industry Users

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 26

Page 27: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Industry Users

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 27

Page 28: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Industry Users

Developers

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 28

Page 29: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

•Don’t need permission to ship an application•No hidden or privileged framework APIs•Can integrate, extend, and replace existing components

Industry Users

Developers

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 29

Page 30: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 30

Page 31: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

IntegrateColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 31

Page 32: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

IntegrateColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 32

Page 33: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

IntegrateColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 33

Page 34: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Integrate ExtendColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 34

Page 35: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Integrate ExtendColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 35

Page 36: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

ReplaceColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 36

Page 37: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

ReplaceColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 37

Page 38: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

ReplaceColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 38

Page 39: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

ReplaceColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 39

Page 40: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

ReplaceColorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 40

Page 41: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Basics of User Interfaces

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 41

Page 42: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Creating UIs

• Two ways to create GUIs: in XML or in code

• Declarative route via XML has advantages

• A lot of your GUI-related work will take place in:

•res/layouts

•res/values

•@id/name_for_component gives you handle for referencing XML declarations in code

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 42

Page 43: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Views

• Views are building blocks

• Examples:

• Can be as basic as: TextView, EditText, or ListView

• Fancier views: ImageView, MapView, WebView

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 43

Page 44: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Layouts

• Controls how Views are laid out

• FrameLayout : each child a layer

• LinearLayout : single row or column

• RelativeLayout : relative to other Views

• TableLayout : rows and columns

• AbsoluteLayout : <x,y> coordinates

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 44

Page 45: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Layouts re-sized

480x320

240x320

320x240

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 45

Page 46: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Layout Parameters

• Specify many aspects of what’s being rendered

• Examples:

• android:layout_height

• android:layout_width

• Tip: start with documentation for a specific View or Layout and then look at what’s inherited from parent class

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 46

Page 47: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Demo: Hello, World!

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 47

Page 48: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Application Components

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 48

Page 49: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Basic components

ActivitiesUI component typically corresponding to one screen.

IntentReceivers Respond to broadcast Intents.

ServicesFaceless tasks that run in the background.

ContentProviders Enable applications to share data.

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 49

Page 50: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Activities

• Typically correspond to one screen in a UI

• But, they can:

• be faceless

• be in a floating window

• return a value

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 50

Page 51: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

IntentReceivers

• Components designed to respond to broadcast Intents

• Think of them as a way to respond to external notifications or alarms

• Applications can invent and broadcast their own Intents as well

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 51

Page 52: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Intents

• Think of Intents as a verb and object; a description of what you want done

• Examples: VIEW, CALL, PLAY, etc.

• System matches Intent with Activity that can best provide that service

• Activities and IntentReceivers describe what Intents they can service in their IntentFilters (via AndroidManifest.xml)

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 52

Page 53: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Intents

GMail

Contacts

Chat

Home

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 53

Page 54: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Intents

GMail

Contacts

Chat

Home

Client component makes a request for a specific action

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 54

Page 55: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Intents

GMail

Contacts

Chat

Home

“Pick photo”

Client component makes a request for a specific action

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 55

Page 56: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Intents

GMail

Contacts

Chat

Home

“Pick photo”

System picks best component for that action

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 56

Page 57: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Intents

GMail

Contacts

Chat

Home

“Pick photo”

System picks best component for that action

Photo Gallery

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 57

Page 58: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Intents

GMail

Contacts

Chat

Home

“Pick photo”

Components can be replaced any time

Photo Gallery

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 58

Page 59: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Intents

GMail

Contacts

Chat

Home

Picasa“Pick photo”

Components can be replaced any time

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 59

Page 60: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Intents

GMail

Contacts

Chat

Home

Picasa

Blogger

“Pick photo”

New components can use existing functionality

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 60

Page 61: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Services

• Faceless components that run in the background

• Example: music player, network download, etc.

• Bind your code to functionality provided by another APK

• Interfaces defined by a remote-able IDL

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 61

Page 62: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

ContentProviders

• Enables sharing of data across applications

• Examples: address book, photo gallery, etc.

• Provides uniform APIs for:

• querying (returns a Cursor)

• delete, update, and insert rows

• Content is represented by URI and MIME type

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 62

Page 63: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Practical matters

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 63

Page 64: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Storage and Persistence

• Multiple options:

• Preferences

• Flat file

• SQLite

• ContentProvider

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 64

Page 65: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Application Packaging

• Think of .apk files as Android packages

• APKs contain everything the application needs

• Basically a glorified ZIP file

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 65

Page 66: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Resources

• res/layout: declarative layout files

• res/drawable: intended for drawing

• res/anim: bitmaps, animations for transitions

• res/values: externalized values for things like strings, colors, styles, etc.

• res/xml: general XML files used at runtime

• res/raw: binary files (e.g. sound)

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 66

Page 67: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Assets

• Similar to Resources

• Differences:

• Read-only

• InputStream access to assets

• Any kind of file

• Be mindful of file sizes

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 67

Page 68: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Application Lifecycle

• Application lifecycle is managed by the system

• Application start/stop is transparent to the user

• End-user only sees that they are moving between screens

• Read documentation for android.app.Activity

• More details in Part 2 later today

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 68

Page 69: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Code Tour: WikiNotes

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 69

Page 70: Building Android Applications - Software Summit · Building Android Applications ... Dan Morrill Ñ Android Development Slide 16. Application Building Blocks Activity

Q & A

• http://code.google.com/android

Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google

Dan Morrill — Android Development Slide 70