Building Android Applications
Upcoming SlideShare
Loading in...5
×
 

Building Android Applications

on

  • 1,445 views

 

Statistics

Views

Total Views
1,445
Views on SlideShare
1,442
Embed Views
3

Actions

Likes
3
Downloads
86
Comments
0

1 Embed 3

http://www.slideshare.net 3

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Building Android Applications Building Android Applications Presentation Transcript

  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Building Android Applications Dan Morrill — Android Development Slide 1
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Agenda • Overview & Inspiration • Application components • Practical matters Dan Morrill — Android Development Slide 2
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google A Powerful Trend Why? Dan Morrill — Android Development Slide 3
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google A Powerful Trend Dan Morrill — Android Development Slide 4
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google A Powerful Trend Internet and Mobile Phone Users, Worldwide 4,000,000,000 3,000,000,000 2,000,000,000 1,000,000,000 0 2000 2001 2002 2003 2004 2005 2006 2007 Internet users (PC-based) Mobile phone users Dan Morrill — Android Development Slide 5
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Open Handset Alliance Members Dan Morrill — Android Development Slide 6
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Open Handset Alliance Members Mobile Operators Dan Morrill — Android Development Slide 7
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Open Handset Alliance Members Handset Manufacturers Mobile Operators Dan Morrill — Android Development Slide 8
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Open Handset Alliance Members Handset Manufacturers Software Mobile Operators Dan Morrill — Android Development Slide 9
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Open Handset Alliance Members Handset Manufacturers Software Mobile Operators Semiconductor Dan Morrill — Android Development Slide 10
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Open Handset Alliance Members Handset Manufacturers Software Mobile Operators Semiconductor Commercialization Dan Morrill — Android Development Slide 11
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Linux Kernel Display Camera Driver Bluetooth Flash Memory Binder (IPC) Driver Driver Driver Driver USB Driver Keypad Driver WiFi Driver Audio Power Drivers Management Dan Morrill — Android Development Slide 12
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Libraries Surface Manager Media SQLite Framework OpenGL | ES FreeType WebKit SGL SSL libc Linux Kernel Display Camera Driver Bluetooth Flash Memory Binder (IPC) Driver Driver Driver Driver USB Driver Keypad Driver WiFi Driver Audio Power Drivers Management Dan Morrill — Android Development Slide 13
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Libraries Android Runtime Surface Manager Media SQLite Core Libraries Framework OpenGL | ES FreeType WebKit Dalvik Virtual Machine SGL SSL libc Linux Kernel Display Camera Driver Bluetooth Flash Memory Binder (IPC) Driver Driver Driver Driver USB Driver Keypad Driver WiFi Driver Audio Power Drivers Management Dan Morrill — Android Development Slide 14
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Application Framework Activity Manager Window Content View Notification Manager Providers System Manager Package Manager Telephony Resource Location GTalk Service Manager Manager Manager Libraries Android Runtime Surface Manager Media SQLite Core Libraries Framework OpenGL | ES FreeType WebKit Dalvik Virtual Machine SGL SSL libc Linux Kernel Display Camera Driver Bluetooth Flash Memory Binder (IPC) Driver Driver Driver Driver USB Driver Keypad Driver WiFi Driver Audio Power Drivers Management Dan Morrill — Android Development Slide 15
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Applications Home Contacts Phone Browser ... Application Framework Activity Manager Window Content View Notification Manager Providers System Manager Package Manager Telephony Resource Location GTalk Service Manager Manager Manager Libraries Android Runtime Surface Manager Media SQLite Core Libraries Framework OpenGL | ES FreeType WebKit Dalvik Virtual Machine SGL SSL libc Linux Kernel Display Camera Driver Bluetooth Flash Memory Binder (IPC) Driver Driver Driver Driver USB Driver Keypad Driver WiFi Driver Audio Power Drivers Management Dan Morrill — Android Development Slide 16
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Application Building Blocks UI component typically corresponding to Activity one screen. Set and respond to notifications or status IntentReceiver changes. Can wake up your app. Service Faceless task that runs in the background. ContentProvider Enable applications to share data. Dan Morrill — Android Development Slide 17
  • Emulator Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • QEMU-based ARM emulator runs same system image as a device • Use same toolchain to work with devices or emulator Dan Morrill — Android Development Slide 18
  • Eclipse Plugin Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Project template Dan Morrill — Android Development Slide 19
  • Debugging Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Call stack Examine variables Breakpoints, single stepping Dan Morrill — Android Development Slide 20
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Dan Morrill — Android Development Slide 21
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Industry Dan Morrill — Android Development Slide 22
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google •Software stack open- sourced under Apache 2.0 license Industry •Source available after first handsets ship •Anyone will be able to build a system image Dan Morrill — Android Development Slide 23
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Industry Dan Morrill — Android Development Slide 24
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Industry Users Dan Morrill — Android Development Slide 25
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google •Users have control of their experience Industry •They control what gets Users installed •They choose the defaults Dan Morrill — Android Development Slide 26
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Industry Users Dan Morrill — Android Development Slide 27
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Developers Industry Users Dan Morrill — Android Development Slide 28
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Developers •Don’t need permission to ship an application •No hidden or privileged Industry framework APIs Users •Can integrate, extend, and replace existing components Dan Morrill — Android Development Slide 29
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Dan Morrill — Android Development Slide 30
  • Integrate Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Dan Morrill — Android Development Slide 31
  • Integrate Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Dan Morrill — Android Development Slide 32
  • Integrate Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Dan Morrill — Android Development Slide 33
  • Integrate Extend Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Dan Morrill — Android Development Slide 34
  • Integrate Extend Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Dan Morrill — Android Development Slide 35
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Replace Dan Morrill — Android Development Slide 36
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Replace Dan Morrill — Android Development Slide 37
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Replace Dan Morrill — Android Development Slide 38
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Replace Dan Morrill — Android Development Slide 39
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Replace Dan Morrill — Android Development Slide 40
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Basics of User Interfaces Dan Morrill — Android Development Slide 41
  • Creating UIs Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • 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 Dan Morrill — Android Development Slide 42
  • Views Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • Views are building blocks • Examples: • Can be as basic as: TextView, EditText, or ListView • Fancier views: ImageView, MapView, WebView Dan Morrill — Android Development Slide 43
  • Layouts Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • 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 Dan Morrill — Android Development Slide 44
  • Layouts re-sized Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google 480x320 240x320 320x240 Dan Morrill — Android Development Slide 45
  • Layout Parameters Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • 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 Dan Morrill — Android Development Slide 46
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Demo: Hello, World! Dan Morrill — Android Development Slide 47
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Application Components Dan Morrill — Android Development Slide 48
  • Basic components Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google UI component typically Activities corresponding to one screen. IntentReceivers Respond to broadcast Intents. Faceless tasks that run in the Services background. ContentProviders Enable applications to share data. Dan Morrill — Android Development Slide 49
  • Activities Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • Typically correspond to one screen in a UI • But, they can: • be faceless • be in a floating window • return a value Dan Morrill — Android Development Slide 50
  • IntentReceivers Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • 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 Dan Morrill — Android Development Slide 51
  • Intents Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • 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) Dan Morrill — Android Development Slide 52
  • Intents Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Home Contacts GMail Chat Dan Morrill — Android Development Slide 53
  • Intents Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Home Contacts GMail Chat Client component makes a request for a specific action Dan Morrill — Android Development Slide 54
  • Intents Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Home Contacts “Pick photo” GMail Chat Client component makes a request for a specific action Dan Morrill — Android Development Slide 55
  • Intents Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Home Contacts “Pick photo” GMail Chat System picks best component for that action Dan Morrill — Android Development Slide 56
  • Intents Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Home Contacts Photo “Pick photo” Gallery GMail Chat System picks best component for that action Dan Morrill — Android Development Slide 57
  • Intents Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Home Contacts Photo “Pick photo” Gallery GMail Chat Components can be replaced any time Dan Morrill — Android Development Slide 58
  • Intents Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Home Contacts “Pick photo” Picasa GMail Chat Components can be replaced any time Dan Morrill — Android Development Slide 59
  • Intents Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Home Contacts “Pick photo” Picasa GMail Chat New components can use existing functionality Blogger Dan Morrill — Android Development Slide 60
  • Services Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • 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 Dan Morrill — Android Development Slide 61
  • ContentProviders Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • 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 Dan Morrill — Android Development Slide 62
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Practical matters Dan Morrill — Android Development Slide 63
  • Storage and Persistence Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • Multiple options: • Preferences • Flat file • SQLite • ContentProvider Dan Morrill — Android Development Slide 64
  • Application Packaging Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • Think of .apk files as Android packages • APKs contain everything the application needs • Basically a glorified ZIP file Dan Morrill — Android Development Slide 65
  • Resources Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • 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) Dan Morrill — Android Development Slide 66
  • Assets Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • Similar to Resources • Differences: • Read-only • InputStream access to assets • Any kind of file • Be mindful of file sizes Dan Morrill — Android Development Slide 67
  • Application Lifecycle Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google • 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 Dan Morrill — Android Development Slide 68
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Code Tour: WikiNotes Dan Morrill — Android Development Slide 69
  • Colorado Software Summit: October 19 – 24, 2008 © Copyright 2008, Google Q &A • http://code.google.com/android Dan Morrill — Android Development Slide 70