SlideShare una empresa de Scribd logo
1 de 49
Descargar para leer sin conexión
An Introduction to Android
      for Developers
Introduction
   Goals
Introduction Goals
• Get you Started with Android Development
• Get the Environment Set Up and Working
• Create Some Demo Apps (Tutorials)
• Demonstrate the Tools / Environment
• Introduction to the Documentation
 • (Which is changing...)
• Build Enthusiasm (you can do it)
Introduction Goals
• Differences from Other Environments
  •UI - Declarative XML Layout
  • Activities
  • Intents / Intent Receivers
  • Services
  • Content Providers
  • Application Life Cycle
• ProjectResources, Building
           Structure
  • Files,
Tools
• SDK
  • Command line tools (adb, aidl, etc.)
  • Supporting Libraries
• IDE (We will use Eclipse)
  • Eclipse Plugin
  • Included:
   • Debugger
   • Profiler
   • Resource Building
   • Deployment
Not Covered
• Java Development Basics
• Similarities to Other Environments
• Parts that Aren’t Ready
 • Syncing etc.
• Anything We Can’t Get to in time!
• Get you going, not teach you everything
GUI Creation
 / Layouts
GUI Creation
• Different from
  • Java Swing
  • Java ME
• Layouts
  • res/layout - XML Files Go Here
  • Layouts - Can be Nested
• Strings / i18n
  • res/values/strings.xml
  • Deployment
GUI Creation
• IDs / Lookup
 • Used to Bridge Views / Java Code
 • @+id/myname Syntax
• Resource Building
 • Eclipse Plugin Builds into R.java
 • Efficient Resource Creation / Representation
 • Less Chance of Programatic Errors (Intellisense)
• XML Declarative Faster to Develop
Layout Basics
• Views Building Blocks
  • Basic
  • TextView, EditText, Button, ImageView,
    Checkbox, Lists, etc
• Layouts : Each Child a Layer
  • FrameLayout
  • LinearLayout : Single Row / Column
  • RelativeLayout : Relative to Parent / Other Views
  • TableLayout : Rows and Columns - HTML like
  • AbsoluteLayout : <x,y> Coords - Discouraged
• Layouts can be Nested
Layout Parameters
• Parameters Control Many Aspects
• Some are More Common:
  • <android:layout_height>
    <android:layout_width> and

   • “wrap_content”, “fill_parent”, values...
  • <android:layout_weight>
   • Relative amount of available space to use
• Most are Reference documentation most useful
           in the Docs
    •Class
When Things Go Wrong
• Android is still early-release software
• Most problems fall within two areas
  •Build Problems
   • R class not updated or running old code
   • Look at console and problems pane
   • Clean Build
  • Communication breakdown to emulator
   • Code not deploying, errors, debugger failure
     • Use DDMS Reset ADB option
     • Or: quit eclipse and emulator, adb kill-server
Hello World
      Demo
First Project with Eclipse

Layout Experimentation
Android
Concepts
Activities
• Typically corresponds to one screen in the UI
  • Can be faceless
  • Can be in a floating window
  • Can return a value
  • Can be embedded
Intents & IntentFilters
• Intents: description of what you want done
• IntentFilter: what an Activity or
  IntentReceiver can do
• Activities publish their IntentFilters in
  AndroidManifest.xml
Intents & IntentFilters
• Forward navigation is accomplished by
  resolving Intents
 • Caller calls startActivity(intent)
    (or startSubActivity... )
 • System picks Activity whose IntentFilter
    best matches intent
 • New Activity is informed of the Intent
IntentReceivers
•   Respond to alarms and notifications

    •   Including those originating externally

•   Will wake up your process if necessary

•   System can broadcast intents: data connection,
    phone state changed, etc

•   Apps can invent and broadcast their own intents
IntentReceivers
•   IntentReceivers can (should) start Services for
    lengthy tasks (e.g. downloading new data)

•   IntentReceivers can put up UI notifications

•   Register IntentReceivers in AndroidManifest.xml

•   Can also attach IntentReceivers to other
    objects so they can receive notifications
    (Activities,Views, etc.)
Services
•   Faceless classes that run in the background

    •   Music player, network download, etc.

•   Services run in your application’s process or
    their own process

•   Your code can bind to Services in your process
    or another process

•   Once bound, you communicate with Services
    using a remotable interface defined in IDL
ContentProviders
• Enable data sharing across applications
• Provide uniform APIs to:
 • query data (returns a Cursor)
 • delete, update, and insert rows
• Hide underlying implementation
• Work across processes
ContentProviders
• All content is represented by URIs
 • Convenience methods mean clients don’t
    need to know syntax
• ContentProviders own URIs based on
  authority, e.g. content://contacts/...
• ContentProviders are responsible for
  mapping URIs they own to a MIME type
Quick Dial
     Code
  Walkthrough
Eclipse Import + Code
Walkthrough
Life Cycle
& Bundles
Application Lifecycle
• Applications run in their own processes
 • Many Activities, Services, etc. can run in
    the same process
• Processes are started and stopped as
  needed to run an application's components
• Processes killed to reclaim resources
Life Cycle
   of an
Application
Activities
• Designed to be reused and replaced
 • Your application can invoke Activities
    from another application
  • Another application can invoke your
    Activities
• Existing Activities can be replaced with a
  new Activity that fulfills the same contract
Activity Lifecycle
• An Application can have Several Activities
• Activities can be started with
  •   startActivity() - Synchronous
  •   startSubActivity() - Asynchronous, with handler
      callback
• Each Activity has its Own Life Cycle
• Messages can be Passed with Bundles
• Like Services on a Bus
Bundles
• Similar in concept to a simple Map
• Can put data into Bundle under a name
 • bundle.putString(“name”, <data object>)
• Can also be retrieved by name
 • bundle.getString(“name”)
• Bundles used to pass messages/store state
• onFreeze() has outState bundle passed in
• Data stored in outstate handed back to
  onCreate as the icicle bundle
Storage / Persistence
• Normally handled by ContentProvider
  •   Front end to File, DB, Online Service, etc.

• SQL Lite is Available to Developers
  •   Simple SQL DB

• Can also access flat files
• Online communication yet to be formalized
Note Pad
       Example
See the Tutorial in the SDK

Multi-stage exercise to illustrate
the basics.
Resources,
Packaging and
  Security
Resources
• Added under the res/values, xml, raw
                           folder
  •layout, drawable, anim,
  • layout for declarative layout files
  • drawable/anim for bitmaps, transitions, etc.
  • values includes strings,more colors,
    dimensions, styles and
                             arrays,

  • xml for general XML files available at runtime
  • raw for binary files (e.g. sound)
• Compiled intoAPI convenience methods
                the apk
  •Read through
  • e.g. XML access looks like a pull parser
Assets
• Similar to Resources,Assets
                          but...
  • InputStream access to
  • Placed under assets folder
  • Looks like a “root” folder to app
  • Read only access
• Any kindon device - watch the size
           of file
  •Stored
APK files
• Android Packages
  •All class files and resources needed to run
    • Class files recoded to dex
  • Manifest defines activities and other facets
• DEX Executable
  •Dalvik
  • More compressed form than bytecode
  • Third party libs can be converted to dex
• APK is the application
  •Install - put APK in data/app
  • Uninstall - remove APK
Security
• Unique Users for Apps
  •App completely sandboxed
  • Sharing only via ContentProviders, Activities,
    IntentReceivers, Services, etc.
  • Strong, linux-backed security
• Accessbe declared in theFeatures
         to Restricted
  •Must                    Manifest
  • Still working on rest of security model
  • Some kind of trusted authority
  • Advanced users should have fine grained control
Other APIs
2D Graphics
• Similar to the Java 2d API methods
  • Canvas passed in to graphics
  • Drawable Resources
  • Alpha channel available
  • Supports transformations (e.g. Rotate, Scale)
• CustomView
          Graphical Components
  •Extend
  • Override onDraw()
  • Override onMeasure() - setMeasuredDimension()
  • Other Optional Overrides: onKeyDown(),
    onKeyUp(), onMotionEvent(), etc.
3D Graphics
• Optional Hardware Support
• OpenGL ES 1.0 OpenGL 1.3 forfeatures)
                  (+ some 1.1
 • Corresponds to              desktop
• Using the API
 • Extend View
 • Obtain handle to OpenGLContext
 • Obtain handle to GL object in onDraw()
Location Based Services
• Optional ID supportedSupport for GPS
             Hardware
 • But Cell                on all devices
• LocationProvider
  • Part of the android.location package
  • Use LocationManager to get location and bearing
  • Context.getSystemService
    (Context.LOCATION_SERVICE)
• Mock in the Emulator
        LocationProviders
  •Test
  • /data/misc/location/<provider_name>
  • class, kml, nmea, track file support
Maps
• Natural complement to LBS
• MapView and MapActivity
 • MapActivity easier to use
 • MapView can be embedded in your app
• MapView more flexibleown controls
 • Can surround with your
 • And, can trigger events in your own activity
 • But, more involved API
 • Must be created in a MapActivity subclass
Media
• Play back and Record media files
• Audio, Picturebeing Video
                  and
 • CODECs still       decided
• Access through Intents
  • Stream from a URL
  • Set MIME type to help decide action
• Also, class level API sound effects)
  • Embed playback (e.g.
  • Recording
XMPP
• Alternative to SMS for message passing
• Can passonly at present including bundles
            richer content,
 • Strings
• Can fire Intents
• Server initiated push
Low-Level H/W Access
• APIs not yet available
• Will cover low-level hardware, e.g.
  •Bluetooth
  • WiFi
Learning More
Learning More
• Sample Lander, Snake - 2d graphics, game
          Apps
  • Lunar
  • Notepad - ContentProvider, Painting override
  • SampleCode - Layouts, Services, Intents &
    Receivers, much more
• Online
  •groups.google.com/group/android-developers
  • /android-beginners,/android-challenge
    /android-internals,
                        /android-discuss,

  • http://android.com
  • http://code.google.com/android
Documentation
• Currently Being Improved
  •Class Documentation Coverage
  • Accessibility
  • Additions - Like Samples, Tutorials, etc.
• Demo
  •Tutorials
  • Class References
    • Including Layout Parameters
  • What’s Included in the Class Libs?
Command Line Tools
• ADB shell - command line into emulator/device
  •adb
      • Simple unix-like shell
      • Can delete apk files from data/app
  • adb install - add packages
• Emulator
  •Many command line flags
      • Different resolution, options, etc.
• Otherdocumentation for aidl, aapt, etc.
        Commands
 • See
• Don’t have to use Eclipse
Questions?

Más contenido relacionado

Similar a Android Bootcamp

An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Androidnatdefreitas
 
APIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty MarketAPIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty MarketScott Abel
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsI Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsMichael Lange
 
Galaxy
GalaxyGalaxy
Galaxybosc
 
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech FestStatic Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech FestDenim Group
 
Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWebDave Bouwman
 
Smart Client Development
Smart Client DevelopmentSmart Client Development
Smart Client DevelopmentTamir Khason
 
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008Vando Batista
 
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume LaforgeGroovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume LaforgeGuillaume Laforge
 
Emulation Bridging The Past To The Future Dirk Von Suchodoletz
Emulation Bridging  The Past To The Future Dirk Von SuchodoletzEmulation Bridging  The Past To The Future Dirk Von Suchodoletz
Emulation Bridging The Past To The Future Dirk Von SuchodoletzDigitalPreservationEurope
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorialoscon2007
 
Android webinar class_1
Android webinar class_1Android webinar class_1
Android webinar class_1Edureka!
 
Internet-enabled GIS Using Free and Open Source Tools
Internet-enabled GIS Using Free and Open Source ToolsInternet-enabled GIS Using Free and Open Source Tools
Internet-enabled GIS Using Free and Open Source ToolsJohn Reiser
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions newJoe Jacob
 
Sql 2008 For Developers
Sql 2008 For DevelopersSql 2008 For Developers
Sql 2008 For DevelopersMithun T. Dhar
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101Michael Angelo Rivera
 
Pref Presentation (2)
Pref Presentation (2)Pref Presentation (2)
Pref Presentation (2)Prachi Patil
 

Similar a Android Bootcamp (20)

An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
APIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty MarketAPIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty Market
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsI Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
 
Galaxy
GalaxyGalaxy
Galaxy
 
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech FestStatic Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
 
Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWeb
 
Smart Client Development
Smart Client DevelopmentSmart Client Development
Smart Client Development
 
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
 
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume LaforgeGroovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
 
Os Haase
Os HaaseOs Haase
Os Haase
 
Emulation Bridging The Past To The Future Dirk Von Suchodoletz
Emulation Bridging  The Past To The Future Dirk Von SuchodoletzEmulation Bridging  The Past To The Future Dirk Von Suchodoletz
Emulation Bridging The Past To The Future Dirk Von Suchodoletz
 
C Language
C LanguageC Language
C Language
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
 
Android webinar class_1
Android webinar class_1Android webinar class_1
Android webinar class_1
 
PPT Companion to Android
PPT Companion to AndroidPPT Companion to Android
PPT Companion to Android
 
Internet-enabled GIS Using Free and Open Source Tools
Internet-enabled GIS Using Free and Open Source ToolsInternet-enabled GIS Using Free and Open Source Tools
Internet-enabled GIS Using Free and Open Source Tools
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions new
 
Sql 2008 For Developers
Sql 2008 For DevelopersSql 2008 For Developers
Sql 2008 For Developers
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101
 
Pref Presentation (2)
Pref Presentation (2)Pref Presentation (2)
Pref Presentation (2)
 

Último

2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdfThe Good Food Institute
 
Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTopCSSGallery
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)codyslingerland1
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfTejal81
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024Brian Pichman
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInThousandEyes
 
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveKeep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveIES VE
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Libraryshyamraj55
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNeo4j
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FESTBillieHyde
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxKaustubhBhavsar6
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfInfopole1
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxNeo4j
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxSatishbabu Gunukula
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIVijayananda Mohire
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3DianaGray10
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Alkin Tezuysal
 
AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024Brian Pichman
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosErol GIRAUDY
 

Último (20)

2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf
 
Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development Companies
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
 
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveKeep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Library
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4j
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FEST
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptx
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdf
 
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
 
SheDev 2024
SheDev 2024SheDev 2024
SheDev 2024
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptx
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAI
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
 
AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenarios
 

Android Bootcamp

  • 1. An Introduction to Android for Developers
  • 2. Introduction Goals
  • 3. Introduction Goals • Get you Started with Android Development • Get the Environment Set Up and Working • Create Some Demo Apps (Tutorials) • Demonstrate the Tools / Environment • Introduction to the Documentation • (Which is changing...) • Build Enthusiasm (you can do it)
  • 4. Introduction Goals • Differences from Other Environments •UI - Declarative XML Layout • Activities • Intents / Intent Receivers • Services • Content Providers • Application Life Cycle • ProjectResources, Building Structure • Files,
  • 5. Tools • SDK • Command line tools (adb, aidl, etc.) • Supporting Libraries • IDE (We will use Eclipse) • Eclipse Plugin • Included: • Debugger • Profiler • Resource Building • Deployment
  • 6. Not Covered • Java Development Basics • Similarities to Other Environments • Parts that Aren’t Ready • Syncing etc. • Anything We Can’t Get to in time! • Get you going, not teach you everything
  • 7. GUI Creation / Layouts
  • 8. GUI Creation • Different from • Java Swing • Java ME • Layouts • res/layout - XML Files Go Here • Layouts - Can be Nested • Strings / i18n • res/values/strings.xml • Deployment
  • 9. GUI Creation • IDs / Lookup • Used to Bridge Views / Java Code • @+id/myname Syntax • Resource Building • Eclipse Plugin Builds into R.java • Efficient Resource Creation / Representation • Less Chance of Programatic Errors (Intellisense) • XML Declarative Faster to Develop
  • 10. Layout Basics • Views Building Blocks • Basic • TextView, EditText, Button, ImageView, Checkbox, Lists, etc • Layouts : Each Child a Layer • FrameLayout • LinearLayout : Single Row / Column • RelativeLayout : Relative to Parent / Other Views • TableLayout : Rows and Columns - HTML like • AbsoluteLayout : <x,y> Coords - Discouraged • Layouts can be Nested
  • 11. Layout Parameters • Parameters Control Many Aspects • Some are More Common: • <android:layout_height> <android:layout_width> and • “wrap_content”, “fill_parent”, values... • <android:layout_weight> • Relative amount of available space to use • Most are Reference documentation most useful in the Docs •Class
  • 12. When Things Go Wrong • Android is still early-release software • Most problems fall within two areas •Build Problems • R class not updated or running old code • Look at console and problems pane • Clean Build • Communication breakdown to emulator • Code not deploying, errors, debugger failure • Use DDMS Reset ADB option • Or: quit eclipse and emulator, adb kill-server
  • 13. Hello World Demo First Project with Eclipse Layout Experimentation
  • 15. Activities • Typically corresponds to one screen in the UI • Can be faceless • Can be in a floating window • Can return a value • Can be embedded
  • 16. Intents & IntentFilters • Intents: description of what you want done • IntentFilter: what an Activity or IntentReceiver can do • Activities publish their IntentFilters in AndroidManifest.xml
  • 17. Intents & IntentFilters • Forward navigation is accomplished by resolving Intents • Caller calls startActivity(intent) (or startSubActivity... ) • System picks Activity whose IntentFilter best matches intent • New Activity is informed of the Intent
  • 18. IntentReceivers • Respond to alarms and notifications • Including those originating externally • Will wake up your process if necessary • System can broadcast intents: data connection, phone state changed, etc • Apps can invent and broadcast their own intents
  • 19. IntentReceivers • IntentReceivers can (should) start Services for lengthy tasks (e.g. downloading new data) • IntentReceivers can put up UI notifications • Register IntentReceivers in AndroidManifest.xml • Can also attach IntentReceivers to other objects so they can receive notifications (Activities,Views, etc.)
  • 20. Services • Faceless classes that run in the background • Music player, network download, etc. • Services run in your application’s process or their own process • Your code can bind to Services in your process or another process • Once bound, you communicate with Services using a remotable interface defined in IDL
  • 21. ContentProviders • Enable data sharing across applications • Provide uniform APIs to: • query data (returns a Cursor) • delete, update, and insert rows • Hide underlying implementation • Work across processes
  • 22. ContentProviders • All content is represented by URIs • Convenience methods mean clients don’t need to know syntax • ContentProviders own URIs based on authority, e.g. content://contacts/... • ContentProviders are responsible for mapping URIs they own to a MIME type
  • 23. Quick Dial Code Walkthrough Eclipse Import + Code Walkthrough
  • 25. Application Lifecycle • Applications run in their own processes • Many Activities, Services, etc. can run in the same process • Processes are started and stopped as needed to run an application's components • Processes killed to reclaim resources
  • 26. Life Cycle of an Application
  • 27. Activities • Designed to be reused and replaced • Your application can invoke Activities from another application • Another application can invoke your Activities • Existing Activities can be replaced with a new Activity that fulfills the same contract
  • 28. Activity Lifecycle • An Application can have Several Activities • Activities can be started with • startActivity() - Synchronous • startSubActivity() - Asynchronous, with handler callback • Each Activity has its Own Life Cycle • Messages can be Passed with Bundles • Like Services on a Bus
  • 29. Bundles • Similar in concept to a simple Map • Can put data into Bundle under a name • bundle.putString(“name”, <data object>) • Can also be retrieved by name • bundle.getString(“name”) • Bundles used to pass messages/store state • onFreeze() has outState bundle passed in • Data stored in outstate handed back to onCreate as the icicle bundle
  • 30. Storage / Persistence • Normally handled by ContentProvider • Front end to File, DB, Online Service, etc. • SQL Lite is Available to Developers • Simple SQL DB • Can also access flat files • Online communication yet to be formalized
  • 31. Note Pad Example See the Tutorial in the SDK Multi-stage exercise to illustrate the basics.
  • 33. Resources • Added under the res/values, xml, raw folder •layout, drawable, anim, • layout for declarative layout files • drawable/anim for bitmaps, transitions, etc. • values includes strings,more colors, dimensions, styles and arrays, • xml for general XML files available at runtime • raw for binary files (e.g. sound) • Compiled intoAPI convenience methods the apk •Read through • e.g. XML access looks like a pull parser
  • 34. Assets • Similar to Resources,Assets but... • InputStream access to • Placed under assets folder • Looks like a “root” folder to app • Read only access • Any kindon device - watch the size of file •Stored
  • 35. APK files • Android Packages •All class files and resources needed to run • Class files recoded to dex • Manifest defines activities and other facets • DEX Executable •Dalvik • More compressed form than bytecode • Third party libs can be converted to dex • APK is the application •Install - put APK in data/app • Uninstall - remove APK
  • 36. Security • Unique Users for Apps •App completely sandboxed • Sharing only via ContentProviders, Activities, IntentReceivers, Services, etc. • Strong, linux-backed security • Accessbe declared in theFeatures to Restricted •Must Manifest • Still working on rest of security model • Some kind of trusted authority • Advanced users should have fine grained control
  • 38. 2D Graphics • Similar to the Java 2d API methods • Canvas passed in to graphics • Drawable Resources • Alpha channel available • Supports transformations (e.g. Rotate, Scale) • CustomView Graphical Components •Extend • Override onDraw() • Override onMeasure() - setMeasuredDimension() • Other Optional Overrides: onKeyDown(), onKeyUp(), onMotionEvent(), etc.
  • 39. 3D Graphics • Optional Hardware Support • OpenGL ES 1.0 OpenGL 1.3 forfeatures) (+ some 1.1 • Corresponds to desktop • Using the API • Extend View • Obtain handle to OpenGLContext • Obtain handle to GL object in onDraw()
  • 40. Location Based Services • Optional ID supportedSupport for GPS Hardware • But Cell on all devices • LocationProvider • Part of the android.location package • Use LocationManager to get location and bearing • Context.getSystemService (Context.LOCATION_SERVICE) • Mock in the Emulator LocationProviders •Test • /data/misc/location/<provider_name> • class, kml, nmea, track file support
  • 41. Maps • Natural complement to LBS • MapView and MapActivity • MapActivity easier to use • MapView can be embedded in your app • MapView more flexibleown controls • Can surround with your • And, can trigger events in your own activity • But, more involved API • Must be created in a MapActivity subclass
  • 42. Media • Play back and Record media files • Audio, Picturebeing Video and • CODECs still decided • Access through Intents • Stream from a URL • Set MIME type to help decide action • Also, class level API sound effects) • Embed playback (e.g. • Recording
  • 43. XMPP • Alternative to SMS for message passing • Can passonly at present including bundles richer content, • Strings • Can fire Intents • Server initiated push
  • 44. Low-Level H/W Access • APIs not yet available • Will cover low-level hardware, e.g. •Bluetooth • WiFi
  • 46. Learning More • Sample Lander, Snake - 2d graphics, game Apps • Lunar • Notepad - ContentProvider, Painting override • SampleCode - Layouts, Services, Intents & Receivers, much more • Online •groups.google.com/group/android-developers • /android-beginners,/android-challenge /android-internals, /android-discuss, • http://android.com • http://code.google.com/android
  • 47. Documentation • Currently Being Improved •Class Documentation Coverage • Accessibility • Additions - Like Samples, Tutorials, etc. • Demo •Tutorials • Class References • Including Layout Parameters • What’s Included in the Class Libs?
  • 48. Command Line Tools • ADB shell - command line into emulator/device •adb • Simple unix-like shell • Can delete apk files from data/app • adb install - add packages • Emulator •Many command line flags • Different resolution, options, etc. • Otherdocumentation for aidl, aapt, etc. Commands • See • Don’t have to use Eclipse