Android application development

Linh Vi Tường
Android Application Development
              Daniel Switkin
   Senior Software Engineer, Google Inc.
Goal

• Get you an idea of how to start developing
  Android applications
• Introduce major Android application concepts
• Walk you through a sample application in the
  development environment
Agenda


•   System architecture

•   Hello World!

•   Application components

•   Practical matters

•   Toolchain
What is Android?

• A free, open source mobile platform
• A Linux-based, multiprocess, multithreaded OS
• Android is not a device or a product
• It’s not even limited to phones - you could build
  a DVR, a handheld GPS, an MP3 player, etc.
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
Hello World!
The History of GUIs


• Hardcoded to the screen
• Hardcoded to the window
• Hardcoded within a view hierarchy
• Dynamic layout within a view hierarchy
Generating GUIs
• 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/layout
 •res/values
•@id/name_for_component gives you
  handle for referencing XML declarations in code
Views

• Views are building blocks
• Examples:
 • Can be as basic as: TextView, EditText, or
    ListView
 • Fancier views: ImageView, MapView, WebView
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
Layouts are resizable




480x320

                        240x320


                        320x240
Layouts are customizable




res/layout/share.xml   res/layout-land/share.xml
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
Application Components
Basic components
                   UI component typically
    Activities
                   corresponding to one screen.
BroadcastReceivers Respond to broadcast Intents.
                   Faceless tasks that run in the
     Services
                   background.
ContentProviders   Enable applications to share data.
Activities

• Typically correspond to one screen in a UI
• But, they can:
 • be faceless
 • be in a floating window
 • return a value
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 BroadcastReceivers describe what
  Intents they can service in their IntentFilters (via
  AndroidManifest.xml)
Intents

    Home



   Contacts
                                     Photo
              “Pick photo”           Picasa
                                     Gallery

    GMail



    Chat
                 New components
                 Components can makes
                 System picks best can
                 Client componentbe usea
                 existing any specific
                 replacedfunctionality
                 component for that action
                 request for a time action
   Blogger
BroadcastReceivers

• 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
Services

• Faceless components that run in the background
 • Example: music player, network downlaod, etc.
• Bind your code to a running service via a
  remote-able interface defined in an IDL
• Can run in your own process or separate
  process
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
Practical matters
Storage and Persistence

• A couple of different options:
 • Preferences
 • Flat file
 • SQLite
 • ContentProvider
Packaging


• Think of .apk files as Android packages
• Everything needed for an application is bundled
  up therein
• Basically a glorified ZIP file
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)
Assets
• Similar to Resources
• Differences:
 • Read-only
 • InputStream access to assets
• Any kind of file
 • Be mindful of file sizes
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
Toolchain
Emulator

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

           • Use same toolchain to work
             with devices or emulator
Eclipse Plugin
Project template
Debugging

 Call stack



                                Examine variables




 Breakpoints, single stepping
Eclipse demo
Q &A
1 de 33

Recomendados

2019-Nov: Domain Driven Design (DDD) and when not to use it por
2019-Nov: Domain Driven Design (DDD) and when not to use it2019-Nov: Domain Driven Design (DDD) and when not to use it
2019-Nov: Domain Driven Design (DDD) and when not to use itMark Windholtz
67 visualizações45 slides
Domain Driven Design - Distillation - Chapter 15 por
Domain Driven Design - Distillation - Chapter 15Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15Mark Windholtz
152 visualizações31 slides
Domain Driven Design Big Picture Strategic Patterns por
Domain Driven Design Big Picture Strategic PatternsDomain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic PatternsMark Windholtz
125 visualizações34 slides
Domain Driven Design Communication Techniques por
Domain Driven Design Communication TechniquesDomain Driven Design Communication Techniques
Domain Driven Design Communication TechniquesMark Windholtz
123 visualizações27 slides
Unlock the Power of Streaming Data with Kinetica and Confluent Platform por
Unlock the Power of Streaming Data with Kinetica and Confluent PlatformUnlock the Power of Streaming Data with Kinetica and Confluent Platform
Unlock the Power of Streaming Data with Kinetica and Confluent Platformconfluent
212 visualizações41 slides
Basic C# and .net por
Basic C# and .netBasic C# and .net
Basic C# and .netJannatul Ferdus
60 visualizações16 slides

Mais conteúdo relacionado

Mais procurados

ENVI/IDL for HDF por
ENVI/IDL for HDFENVI/IDL for HDF
ENVI/IDL for HDFThe HDF-EOS Tools and Information Center
744 visualizações9 slides
Android for Java Developers at OSCON 2010 por
Android for Java Developers at OSCON 2010Android for Java Developers at OSCON 2010
Android for Java Developers at OSCON 2010Marko Gargenta
853 visualizações51 slides
Open Android por
Open AndroidOpen Android
Open AndroidMarko Gargenta
1.9K visualizações45 slides
Colors por
ColorsColors
ColorsHajime Hotta
456 visualizações4 slides
Exchange with anypoint platform por
Exchange with anypoint platformExchange with anypoint platform
Exchange with anypoint platformSon Nguyen
187 visualizações7 slides
Android For Managers Slides por
Android For Managers SlidesAndroid For Managers Slides
Android For Managers SlidesMarko Gargenta
1.5K visualizações52 slides

Mais procurados(8)

Android for Java Developers at OSCON 2010 por Marko Gargenta
Android for Java Developers at OSCON 2010Android for Java Developers at OSCON 2010
Android for Java Developers at OSCON 2010
Marko Gargenta853 visualizações
Open Android por Marko Gargenta
Open AndroidOpen Android
Open Android
Marko Gargenta1.9K visualizações
Colors por Hajime Hotta
ColorsColors
Colors
Hajime Hotta456 visualizações
Exchange with anypoint platform por Son Nguyen
Exchange with anypoint platformExchange with anypoint platform
Exchange with anypoint platform
Son Nguyen187 visualizações
Android For Managers Slides por Marko Gargenta
Android For Managers SlidesAndroid For Managers Slides
Android For Managers Slides
Marko Gargenta1.5K visualizações
Web based tool for domain specific modeling por PG Scholar
Web based tool for domain specific modeling Web based tool for domain specific modeling
Web based tool for domain specific modeling
PG Scholar481 visualizações
Android Internals por Marko Gargenta
Android InternalsAndroid Internals
Android Internals
Marko Gargenta1.8K visualizações

Destaque

11 por
1111
11taha4423
327 visualizações27 slides
Insani degerleri yasamak (1) por
Insani degerleri yasamak (1)Insani degerleri yasamak (1)
Insani degerleri yasamak (1)taha4423
830 visualizações16 slides
Presentation1 por
Presentation1Presentation1
Presentation1tharkness
44 visualizações6 slides
Sivil toplum kuruluslari por
Sivil toplum kuruluslariSivil toplum kuruluslari
Sivil toplum kuruluslaritaha4423
864 visualizações23 slides
3hafta por
3hafta3hafta
3haftataha4423
306 visualizações12 slides
Przegląd rysunków – Robert Ratajczak por
Przegląd rysunków – Robert RatajczakPrzegląd rysunków – Robert Ratajczak
Przegląd rysunków – Robert Ratajczakratajczak.robert
354 visualizações36 slides

Destaque(9)

11 por taha4423
1111
11
taha4423327 visualizações
Insani degerleri yasamak (1) por taha4423
Insani degerleri yasamak (1)Insani degerleri yasamak (1)
Insani degerleri yasamak (1)
taha4423830 visualizações
Presentation1 por tharkness
Presentation1Presentation1
Presentation1
tharkness44 visualizações
Sivil toplum kuruluslari por taha4423
Sivil toplum kuruluslariSivil toplum kuruluslari
Sivil toplum kuruluslari
taha4423864 visualizações
3hafta por taha4423
3hafta3hafta
3hafta
taha4423306 visualizações
Przegląd rysunków – Robert Ratajczak por ratajczak.robert
Przegląd rysunków – Robert RatajczakPrzegląd rysunków – Robert Ratajczak
Przegląd rysunków – Robert Ratajczak
ratajczak.robert354 visualizações
Insan hayatina ve_onuruna_saygi (1) por taha4423
Insan hayatina ve_onuruna_saygi (1)Insan hayatina ve_onuruna_saygi (1)
Insan hayatina ve_onuruna_saygi (1)
taha44231.6K visualizações
Presentation1 por tharkness
Presentation1Presentation1
Presentation1
tharkness56 visualizações
12 por taha4423
1212
12
taha4423427 visualizações

Similar a Android application development

Lecture3 por
Lecture3Lecture3
Lecture3jousterlabs
230 visualizações33 slides
Android Introduction por
Android IntroductionAndroid Introduction
Android IntroductionSharmistha Mandal
574 visualizações20 slides
My androidpresentation por
My androidpresentationMy androidpresentation
My androidpresentationniteshnarayanlal
451 visualizações42 slides
Android quick talk por
Android quick talkAndroid quick talk
Android quick talkSenthilKumar Selvaraj
1.1K visualizações66 slides
Introduction to Android por
Introduction to AndroidIntroduction to Android
Introduction to AndroidNitinMehra2205
934 visualizações29 slides
Introduction to android por
Introduction to androidIntroduction to android
Introduction to androidJawad Mohmand
1.5K visualizações35 slides

Similar a Android application development(20)

Lecture3 por jousterlabs
Lecture3Lecture3
Lecture3
jousterlabs230 visualizações
Android Introduction por Sharmistha Mandal
Android IntroductionAndroid Introduction
Android Introduction
Sharmistha Mandal574 visualizações
My androidpresentation por niteshnarayanlal
My androidpresentationMy androidpresentation
My androidpresentation
niteshnarayanlal451 visualizações
Introduction to Android por NitinMehra2205
Introduction to AndroidIntroduction to Android
Introduction to Android
NitinMehra2205934 visualizações
Introduction to android por Jawad Mohmand
Introduction to androidIntroduction to android
Introduction to android
Jawad Mohmand1.5K visualizações
Android Workshop_1 por Purvik Rana
Android Workshop_1Android Workshop_1
Android Workshop_1
Purvik Rana517 visualizações
Google Developer Group(GDG) DevFest Event 2012 Android talk por Imam Raza
Google Developer Group(GDG) DevFest Event 2012 Android talkGoogle Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talk
Imam Raza1.4K visualizações
Introduction to Android (before 2015) por Chien-Ming Chou
Introduction to Android (before 2015)Introduction to Android (before 2015)
Introduction to Android (before 2015)
Chien-Ming Chou346 visualizações
Android General information por Prashant Gosai
Android General informationAndroid General information
Android General information
Prashant Gosai1.2K visualizações
Android OS and its Features por Harshad Lokhande
Android OS and its FeaturesAndroid OS and its Features
Android OS and its Features
Harshad Lokhande1.7K visualizações
Enhancing and modifying_the_core_android_os por Arnav Gupta
Enhancing and modifying_the_core_android_osEnhancing and modifying_the_core_android_os
Enhancing and modifying_the_core_android_os
Arnav Gupta717 visualizações
Androidify workshop por Alexey Buzdin
Androidify workshopAndroidify workshop
Androidify workshop
Alexey Buzdin770 visualizações
Android Training por Tbldevelopment
Android TrainingAndroid Training
Android Training
Tbldevelopment7.8K visualizações
Android fundamentals and tutorial for beginners por Boom Shukla
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
Boom Shukla11.2K visualizações
Android- Introduction for Beginners por Tripti Tiwari
Android- Introduction for BeginnersAndroid- Introduction for Beginners
Android- Introduction for Beginners
Tripti Tiwari1.4K visualizações
Introduction to Android Development por Can Elmas
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
Can Elmas1K visualizações
Synapseindia android apps application development por Synapseindiappsdevelopment
Synapseindia android apps application developmentSynapseindia android apps application development
Synapseindia android apps application development
Synapseindiappsdevelopment334 visualizações
Android OS por Nitin Ramchandani
Android OSAndroid OS
Android OS
Nitin Ramchandani2.7K visualizações

Último

Women from Hackney’s History: Stoke Newington by Sue Doe por
Women from Hackney’s History: Stoke Newington by Sue DoeWomen from Hackney’s History: Stoke Newington by Sue Doe
Women from Hackney’s History: Stoke Newington by Sue DoeHistory of Stoke Newington
163 visualizações21 slides
Monthly Information Session for MV Asterix (November) por
Monthly Information Session for MV Asterix (November)Monthly Information Session for MV Asterix (November)
Monthly Information Session for MV Asterix (November)Esquimalt MFRC
72 visualizações26 slides
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptx por
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptxCollective Bargaining and Understanding a Teacher Contract(16793704.1).pptx
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptxCenter for Integrated Training & Education
95 visualizações57 slides
Google solution challenge..pptx por
Google solution challenge..pptxGoogle solution challenge..pptx
Google solution challenge..pptxChitreshGyanani1
148 visualizações18 slides
AUDIENCE - BANDURA.pptx por
AUDIENCE - BANDURA.pptxAUDIENCE - BANDURA.pptx
AUDIENCE - BANDURA.pptxiammrhaywood
117 visualizações44 slides
Relationship of psychology with other subjects. por
Relationship of psychology with other subjects.Relationship of psychology with other subjects.
Relationship of psychology with other subjects.palswagata2003
52 visualizações16 slides

Último(20)

Women from Hackney’s History: Stoke Newington by Sue Doe por History of Stoke Newington
Women from Hackney’s History: Stoke Newington by Sue DoeWomen from Hackney’s History: Stoke Newington by Sue Doe
Women from Hackney’s History: Stoke Newington by Sue Doe
History of Stoke Newington163 visualizações
Monthly Information Session for MV Asterix (November) por Esquimalt MFRC
Monthly Information Session for MV Asterix (November)Monthly Information Session for MV Asterix (November)
Monthly Information Session for MV Asterix (November)
Esquimalt MFRC72 visualizações
Google solution challenge..pptx por ChitreshGyanani1
Google solution challenge..pptxGoogle solution challenge..pptx
Google solution challenge..pptx
ChitreshGyanani1148 visualizações
AUDIENCE - BANDURA.pptx por iammrhaywood
AUDIENCE - BANDURA.pptxAUDIENCE - BANDURA.pptx
AUDIENCE - BANDURA.pptx
iammrhaywood117 visualizações
Relationship of psychology with other subjects. por palswagata2003
Relationship of psychology with other subjects.Relationship of psychology with other subjects.
Relationship of psychology with other subjects.
palswagata200352 visualizações
MIXING OF PHARMACEUTICALS.pptx por Anupkumar Sharma
MIXING OF PHARMACEUTICALS.pptxMIXING OF PHARMACEUTICALS.pptx
MIXING OF PHARMACEUTICALS.pptx
Anupkumar Sharma95 visualizações
The basics - information, data, technology and systems.pdf por JonathanCovena1
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdf
JonathanCovena1146 visualizações
CONTENTS.pptx por iguerendiain
CONTENTS.pptxCONTENTS.pptx
CONTENTS.pptx
iguerendiain62 visualizações
Sociology KS5 por WestHatch
Sociology KS5Sociology KS5
Sociology KS5
WestHatch85 visualizações
Psychology KS4 por WestHatch
Psychology KS4Psychology KS4
Psychology KS4
WestHatch98 visualizações
REPRESENTATION - GAUNTLET.pptx por iammrhaywood
REPRESENTATION - GAUNTLET.pptxREPRESENTATION - GAUNTLET.pptx
REPRESENTATION - GAUNTLET.pptx
iammrhaywood138 visualizações
Ch. 7 Political Participation and Elections.pptx por Rommel Regala
Ch. 7 Political Participation and Elections.pptxCh. 7 Political Participation and Elections.pptx
Ch. 7 Political Participation and Elections.pptx
Rommel Regala111 visualizações
Create a Structure in VBNet.pptx por Breach_P
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptx
Breach_P78 visualizações
Gopal Chakraborty Memorial Quiz 2.0 Prelims.pptx por Debapriya Chakraborty
Gopal Chakraborty Memorial Quiz 2.0 Prelims.pptxGopal Chakraborty Memorial Quiz 2.0 Prelims.pptx
Gopal Chakraborty Memorial Quiz 2.0 Prelims.pptx
Debapriya Chakraborty695 visualizações
The Accursed House by Émile Gaboriau por DivyaSheta
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile Gaboriau
DivyaSheta223 visualizações
UNIDAD 3 6º C.MEDIO.pptx por MarcosRodriguezUcedo
UNIDAD 3 6º C.MEDIO.pptxUNIDAD 3 6º C.MEDIO.pptx
UNIDAD 3 6º C.MEDIO.pptx
MarcosRodriguezUcedo134 visualizações
Psychology KS5 por WestHatch
Psychology KS5Psychology KS5
Psychology KS5
WestHatch119 visualizações
11.28.23 Social Capital and Social Exclusion.pptx por mary850239
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptx
mary850239312 visualizações

Android application development

  • 1. Android Application Development Daniel Switkin Senior Software Engineer, Google Inc.
  • 2. Goal • Get you an idea of how to start developing Android applications • Introduce major Android application concepts • Walk you through a sample application in the development environment
  • 3. Agenda • System architecture • Hello World! • Application components • Practical matters • Toolchain
  • 4. What is Android? • A free, open source mobile platform • A Linux-based, multiprocess, multithreaded OS • Android is not a device or a product • It’s not even limited to phones - you could build a DVR, a handheld GPS, an MP3 player, etc.
  • 5. 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
  • 7. The History of GUIs • Hardcoded to the screen • Hardcoded to the window • Hardcoded within a view hierarchy • Dynamic layout within a view hierarchy
  • 8. Generating GUIs • 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/layout •res/values •@id/name_for_component gives you handle for referencing XML declarations in code
  • 9. Views • Views are building blocks • Examples: • Can be as basic as: TextView, EditText, or ListView • Fancier views: ImageView, MapView, WebView
  • 10. 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
  • 11. Layouts are resizable 480x320 240x320 320x240
  • 13. 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
  • 15. Basic components UI component typically Activities corresponding to one screen. BroadcastReceivers Respond to broadcast Intents. Faceless tasks that run in the Services background. ContentProviders Enable applications to share data.
  • 16. Activities • Typically correspond to one screen in a UI • But, they can: • be faceless • be in a floating window • return a value
  • 17. 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 BroadcastReceivers describe what Intents they can service in their IntentFilters (via AndroidManifest.xml)
  • 18. Intents Home Contacts Photo “Pick photo” Picasa Gallery GMail Chat New components Components can makes System picks best can Client componentbe usea existing any specific replacedfunctionality component for that action request for a time action Blogger
  • 19. BroadcastReceivers • 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
  • 20. Services • Faceless components that run in the background • Example: music player, network downlaod, etc. • Bind your code to a running service via a remote-able interface defined in an IDL • Can run in your own process or separate process
  • 21. 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
  • 23. Storage and Persistence • A couple of different options: • Preferences • Flat file • SQLite • ContentProvider
  • 24. Packaging • Think of .apk files as Android packages • Everything needed for an application is bundled up therein • Basically a glorified ZIP file
  • 25. 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)
  • 26. Assets • Similar to Resources • Differences: • Read-only • InputStream access to assets • Any kind of file • Be mindful of file sizes
  • 27. 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
  • 29. Emulator • QEMU-based ARM emulator runs same system image as a device • Use same toolchain to work with devices or emulator
  • 31. Debugging Call stack Examine variables Breakpoints, single stepping
  • 33. Q &A