SlideShare a Scribd company logo
1 of 43
Download to read offline
Androidify Yourself!
Alexey Buzdin
Aleksey Nikolaenko
@AlexeyBuzdin
@echoAlexey
Google Developers Group
• Place to discuss, learn, and share passion for
technology
• Focused on developer culture & technical
content
• Free as beer
Today’s agenda
• Setup environment
• Introduction to Android
• Android application
development
• GDG Raffle
http://goo.gl/HIYmeC
Android Studio
• IntelliJ IDEA based
• Gradle build support
• Comes with Android
SDK
• Layout editor with
preview
and much more…
Android platform
• Android is a Linux-based operating system
and a software stack designed for touchscreen
mobile devices
Android Anatomy
Android Runtime
• On Android you develop in Java
• ... but Android does not run Java Bytecode !
Android Runtime
• Custom Virtual Machine. Why?
Constraints
Designed for 64M RAM
No swap
Phone tech v. Desktop
CPU specific
Oracle JVM problems
Memory Hog
Slow startup
IP licensing restrictions
Anatomy of Android application
• AndroidManifest
• Activities
• Fragments
• Intents
• Services
• Content providers
• Broadcast receivers
Android Manifest
• general configuration for your application
• contains all component definitions of your
appication
Activity
• An activity represents a single screen with
a user interface
• An activity is implemented as a subclass of
Activity
Fragment
• A Fragment represents
a behavior or a portion
of user interface in an
Activity
• Affected by lifecycle of
Activity
• subclass of Fragment
Intent
Intent is used to invoke different
components:
• Start a service
• Launch an activity
• Display a web page
• Broadcast a message
Service
• Background process that performs long-
running operations or remote processes
• No user interface for service
• A service is implemented as a subclass of
Service
• Service can be local (accessed within
application) or remote (scope of device)
Content providers
• Content providers are used to share data
between applications
• Can store data in SQLite, Web and other
storages and perform CRUD operations with
Content providers
• subclass of ContentProvider
Broadcast receiver
• Component that responds to system-wide
broadcast announcements (e.g.. Screen is
turns on-off, SMS received,
• Broadcast delivered as Intent
• Don’t have user interface
• Subclass of BroadcastReceiver
Android UI fundamentals
Android UI fundamentals
Screen size
• actual physical size, measured
as the screen's diagonal
• 2.55”, 3.2”, 4.0”, 10.1”, ...
Android groups into four
generalized sizes:
• Small
• Normal
• Large
• Xlarge
Android UI fundamentals
Screen density
• quantity of pixels within a physical area of the
screen (dots per inch, dpi).
• "low" density screen has fewer pixels
• Android groups actual screen densities into four
generalized densities:
• Low (ldpi, 120)
• Medium (mdpi, 160)
• High (hdpi, 240)
• Extra high (xhdpi, 320)
Android UI fundamentals
Density-independent pixel (dp)
• virtual pixel unit to express layout dimensions or
position in a density-independent way
• equivalent to one physical pixel on a 160 dpi screen
• px = dp * (dpi / 160)
• system transparently handles any scaling of the dp
units
Android UI fundamentals
Best practices
• Do not use hard-coded pixel values in your
application code
• Use size and density-specific resources
• Use wrap_content, match_parent, or the dp
unit for layout dimensions
• Test Your Application on Multiple Screens
Android resources
Resources
Android supports the externalization of resources
• strings, colors, images, themes, menus, layouts
• system resources
Why?
• easier to maintain, update, and manage
• easier to define alternative resource values for
internationalization and to support variations in
hardware
res/ & R
res/
• Generated by ADT Wizard
• Each resource type is stored in a
different subfolder
R.java
• Resources from /res are „indexed“ by
ADT or aapt tool
• Enables to reference resources in
code
Default v. Alternative Resources
• For any type of resource, we can specify default
and multiple alternative resources
• Default resources are used regardless of the
device configuration when no alternative
resources match the current configuration
• Alternative resources are designed for use with a
specific configuration
How to specify Alternative Resources
• Create a new directory in res/
• res/<resources_name>-
<config_qualifier>
• <config_qualifier> specifies a
configuration for which these
resources are to be used
• Save your alternative resources
in new directory and name it as
the default resource files
Resource types
• Layouts
• Simple values
– Strings
– Plurals
– Colors
– Dimensions
– Styles
– String or integer arrays
Stored within XML files in
the res/values folder
Resource types
Styles and Themes
• Let your applications
maintain a consistent
look and feel by
enabling you to
specify the attribute
values used by Views
• The most common
use of is to store the
colors and fonts for an
application
Building User Interfaces
View
View
• base class for all visual interface
elements controls, widgets
• an object that draws something on the
screen that the user can interact with
View Group
• extends View class
• an object that holds other Views
View group is an invisible container that
organizes child views, while the child
views draw some part of the UI
Android Layouts
• A layout defines the visual
structure for a user interface,
such as the UI for an activity or
app widget.
• Can be defined in XML or
programmatically during
runtime.
• XML layouts stored in
res/layout folder and are
qualified as resource
Layout
Advantages of declaring UI in XML
• Separation of the presentation from the code that
controls its behavior
• modify UI without having to modify source code
• create XML layouts for different screen
orientations, different device screen sizes, and
different languages
• Easier to visualize the structure of your UI
• Easier to design/debug UI
• Visualizer tool (ADT)
Layout example
ViewGroup
View
Layout types
LinearLayout
• Aligns all children in a single
direction - vertically or horizontally
• All children are stacked one after
the other
• Layout weight (android:
layout_weight) assigns an
"importance" value to a view in
terms of how much space is should
occupy on the screen
LinearLayout
Layout types
RelativeLayout
• view group that displays child
views in relative positions
• can eliminate nested view
groups and keep your layout
hierarchy flat, that improves
performance
• specify the location of child
objects relative to each other
(child A to the left of child B) or
to the parent
Layout Parameters
Layout Parameters (layout_something)
• parent view group defines layout parameters for
each child view (including the child view group)
• child element must define LayoutParams that are
appropriate for its parent
Basic widget toolbox
Questions & Answers
Want to host a workshop or
presentation?
gdgriga@gmail.com
Androidify workshop

More Related Content

What's hot

Android development
Android developmentAndroid development
Android developmentRaynax668
 
Java Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development WorkshopJava Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development WorkshopKasun Dananjaya Delgolla
 
Introduction to Android Development Part 1
Introduction to Android Development Part 1Introduction to Android Development Part 1
Introduction to Android Development Part 1Kainda Kiniel Daka
 
Custom Android App Development – Web Animation India
Custom Android App Development – Web Animation IndiaCustom Android App Development – Web Animation India
Custom Android App Development – Web Animation IndiaMarion Welch
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentCan Elmas
 
Android Training - Part 2
Android Training - Part 2Android Training - Part 2
Android Training - Part 2Tbldevelopment
 
Android workshop
Android workshopAndroid workshop
Android workshopRavi Vyas
 
Basic android development
Basic android developmentBasic android development
Basic android developmentUpanya Singh
 
Project presentation (Loginradius SDK for Android)
Project presentation (Loginradius SDK for Android)Project presentation (Loginradius SDK for Android)
Project presentation (Loginradius SDK for Android)shwetarathi Rathi
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentSander Alberink
 
Android Web app
Android Web app Android Web app
Android Web app Sumit Kumar
 
Android Study Jams - Induction
Android Study Jams - InductionAndroid Study Jams - Induction
Android Study Jams - InductionGDSCAISSMSIOIT
 
Lec004 setting up for development
Lec004   setting up for developmentLec004   setting up for development
Lec004 setting up for developmentEyad Almasri
 
Developing Applications for Android - Lecture#1
Developing Applications for Android - Lecture#1Developing Applications for Android - Lecture#1
Developing Applications for Android - Lecture#1Usman Chaudhry
 
Android Workshop Part 1
Android Workshop Part 1Android Workshop Part 1
Android Workshop Part 1NAILBITER
 

What's hot (20)

Android development
Android developmentAndroid development
Android development
 
Java Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development WorkshopJava Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development Workshop
 
Introduction to Android Development Part 1
Introduction to Android Development Part 1Introduction to Android Development Part 1
Introduction to Android Development Part 1
 
Custom Android App Development – Web Animation India
Custom Android App Development – Web Animation IndiaCustom Android App Development – Web Animation India
Custom Android App Development – Web Animation India
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android Training - Part 2
Android Training - Part 2Android Training - Part 2
Android Training - Part 2
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Basic android development
Basic android developmentBasic android development
Basic android development
 
Project presentation (Loginradius SDK for Android)
Project presentation (Loginradius SDK for Android)Project presentation (Loginradius SDK for Android)
Project presentation (Loginradius SDK for Android)
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android Web app
Android Web app Android Web app
Android Web app
 
Android studio ppt
Android studio pptAndroid studio ppt
Android studio ppt
 
Android Study Jams - Induction
Android Study Jams - InductionAndroid Study Jams - Induction
Android Study Jams - Induction
 
Android
AndroidAndroid
Android
 
Lec004 setting up for development
Lec004   setting up for developmentLec004   setting up for development
Lec004 setting up for development
 
Ci for Android
Ci for AndroidCi for Android
Ci for Android
 
Developing Applications for Android - Lecture#1
Developing Applications for Android - Lecture#1Developing Applications for Android - Lecture#1
Developing Applications for Android - Lecture#1
 
IntroToAndroid
IntroToAndroidIntroToAndroid
IntroToAndroid
 
Android
AndroidAndroid
Android
 
Android Workshop Part 1
Android Workshop Part 1Android Workshop Part 1
Android Workshop Part 1
 

Similar to Androidify workshop

Android webinar class_1
Android webinar class_1Android webinar class_1
Android webinar class_1Edureka!
 
Consistent UI Across Android Devices
Consistent UI Across Android DevicesConsistent UI Across Android Devices
Consistent UI Across Android DevicesIrene Duke
 
Android Workshop_1
Android Workshop_1Android Workshop_1
Android Workshop_1Purvik Rana
 
Android application development
Android application developmentAndroid application development
Android application developmentLinh Vi Tường
 
Introduction to Android Development.pptx
Introduction to Android Development.pptxIntroduction to Android Development.pptx
Introduction to Android Development.pptxasmeerana605
 
Android application development for TresmaxAsia
Android application development for TresmaxAsiaAndroid application development for TresmaxAsia
Android application development for TresmaxAsiaMichael Angelo Rivera
 
Introduction to Android (before 2015)
Introduction to Android (before 2015)Introduction to Android (before 2015)
Introduction to Android (before 2015)Chien-Ming Chou
 
Android Development
Android DevelopmentAndroid Development
Android Developmentmclougm4
 
Learn Android at edureka!
Learn Android at edureka! Learn Android at edureka!
Learn Android at edureka! Edureka!
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersBoom Shukla
 
Developing for Android-Types of Android Application
Developing for Android-Types of Android ApplicationDeveloping for Android-Types of Android Application
Developing for Android-Types of Android ApplicationNandini Prabhu
 
Android OS and its Features
Android OS and its FeaturesAndroid OS and its Features
Android OS and its FeaturesHarshad Lokhande
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_authlzongren
 
Matteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionMatteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionDuckMa
 
Android Introduction
Android IntroductionAndroid Introduction
Android Introductionaswapnal
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_uDoris Chen
 

Similar to Androidify workshop (20)

Lecture3
Lecture3Lecture3
Lecture3
 
Android webinar class_1
Android webinar class_1Android webinar class_1
Android webinar class_1
 
Consistent UI Across Android Devices
Consistent UI Across Android DevicesConsistent UI Across Android Devices
Consistent UI Across Android Devices
 
Android Workshop_1
Android Workshop_1Android Workshop_1
Android Workshop_1
 
Android
Android Android
Android
 
Android application development
Android application developmentAndroid application development
Android application development
 
Introduction to Android Development.pptx
Introduction to Android Development.pptxIntroduction to Android Development.pptx
Introduction to Android Development.pptx
 
Android application development for TresmaxAsia
Android application development for TresmaxAsiaAndroid application development for TresmaxAsia
Android application development for TresmaxAsia
 
Introduction to Android (before 2015)
Introduction to Android (before 2015)Introduction to Android (before 2015)
Introduction to Android (before 2015)
 
Android Technology
Android TechnologyAndroid Technology
Android Technology
 
Android Development
Android DevelopmentAndroid Development
Android Development
 
Learn Android at edureka!
Learn Android at edureka! Learn Android at edureka!
Learn Android at edureka!
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
 
Developing for Android-Types of Android Application
Developing for Android-Types of Android ApplicationDeveloping for Android-Types of Android Application
Developing for Android-Types of Android Application
 
Android OS and its Features
Android OS and its FeaturesAndroid OS and its Features
Android OS and its Features
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Matteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionMatteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break edition
 
Intro to android (gdays)
Intro to android (gdays)Intro to android (gdays)
Intro to android (gdays)
 
Android Introduction
Android IntroductionAndroid Introduction
Android Introduction
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_u
 

Recently uploaded

Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 

Recently uploaded (20)

Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 

Androidify workshop

  • 3. Google Developers Group • Place to discuss, learn, and share passion for technology • Focused on developer culture & technical content • Free as beer
  • 4.
  • 5. Today’s agenda • Setup environment • Introduction to Android • Android application development • GDG Raffle http://goo.gl/HIYmeC
  • 6. Android Studio • IntelliJ IDEA based • Gradle build support • Comes with Android SDK • Layout editor with preview and much more…
  • 7. Android platform • Android is a Linux-based operating system and a software stack designed for touchscreen mobile devices
  • 9. Android Runtime • On Android you develop in Java • ... but Android does not run Java Bytecode !
  • 10. Android Runtime • Custom Virtual Machine. Why? Constraints Designed for 64M RAM No swap Phone tech v. Desktop CPU specific Oracle JVM problems Memory Hog Slow startup IP licensing restrictions
  • 11. Anatomy of Android application • AndroidManifest • Activities • Fragments • Intents • Services • Content providers • Broadcast receivers
  • 12. Android Manifest • general configuration for your application • contains all component definitions of your appication
  • 13. Activity • An activity represents a single screen with a user interface • An activity is implemented as a subclass of Activity
  • 14. Fragment • A Fragment represents a behavior or a portion of user interface in an Activity • Affected by lifecycle of Activity • subclass of Fragment
  • 15. Intent Intent is used to invoke different components: • Start a service • Launch an activity • Display a web page • Broadcast a message
  • 16. Service • Background process that performs long- running operations or remote processes • No user interface for service • A service is implemented as a subclass of Service • Service can be local (accessed within application) or remote (scope of device)
  • 17. Content providers • Content providers are used to share data between applications • Can store data in SQLite, Web and other storages and perform CRUD operations with Content providers • subclass of ContentProvider
  • 18. Broadcast receiver • Component that responds to system-wide broadcast announcements (e.g.. Screen is turns on-off, SMS received, • Broadcast delivered as Intent • Don’t have user interface • Subclass of BroadcastReceiver
  • 20. Android UI fundamentals Screen size • actual physical size, measured as the screen's diagonal • 2.55”, 3.2”, 4.0”, 10.1”, ... Android groups into four generalized sizes: • Small • Normal • Large • Xlarge
  • 21. Android UI fundamentals Screen density • quantity of pixels within a physical area of the screen (dots per inch, dpi). • "low" density screen has fewer pixels • Android groups actual screen densities into four generalized densities: • Low (ldpi, 120) • Medium (mdpi, 160) • High (hdpi, 240) • Extra high (xhdpi, 320)
  • 22. Android UI fundamentals Density-independent pixel (dp) • virtual pixel unit to express layout dimensions or position in a density-independent way • equivalent to one physical pixel on a 160 dpi screen • px = dp * (dpi / 160) • system transparently handles any scaling of the dp units
  • 23. Android UI fundamentals Best practices • Do not use hard-coded pixel values in your application code • Use size and density-specific resources • Use wrap_content, match_parent, or the dp unit for layout dimensions • Test Your Application on Multiple Screens
  • 25. Resources Android supports the externalization of resources • strings, colors, images, themes, menus, layouts • system resources Why? • easier to maintain, update, and manage • easier to define alternative resource values for internationalization and to support variations in hardware
  • 26. res/ & R res/ • Generated by ADT Wizard • Each resource type is stored in a different subfolder R.java • Resources from /res are „indexed“ by ADT or aapt tool • Enables to reference resources in code
  • 27. Default v. Alternative Resources • For any type of resource, we can specify default and multiple alternative resources • Default resources are used regardless of the device configuration when no alternative resources match the current configuration • Alternative resources are designed for use with a specific configuration
  • 28. How to specify Alternative Resources • Create a new directory in res/ • res/<resources_name>- <config_qualifier> • <config_qualifier> specifies a configuration for which these resources are to be used • Save your alternative resources in new directory and name it as the default resource files
  • 29. Resource types • Layouts • Simple values – Strings – Plurals – Colors – Dimensions – Styles – String or integer arrays Stored within XML files in the res/values folder
  • 30. Resource types Styles and Themes • Let your applications maintain a consistent look and feel by enabling you to specify the attribute values used by Views • The most common use of is to store the colors and fonts for an application
  • 32. View View • base class for all visual interface elements controls, widgets • an object that draws something on the screen that the user can interact with View Group • extends View class • an object that holds other Views View group is an invisible container that organizes child views, while the child views draw some part of the UI
  • 33. Android Layouts • A layout defines the visual structure for a user interface, such as the UI for an activity or app widget. • Can be defined in XML or programmatically during runtime. • XML layouts stored in res/layout folder and are qualified as resource
  • 34. Layout Advantages of declaring UI in XML • Separation of the presentation from the code that controls its behavior • modify UI without having to modify source code • create XML layouts for different screen orientations, different device screen sizes, and different languages • Easier to visualize the structure of your UI • Easier to design/debug UI • Visualizer tool (ADT)
  • 36. Layout types LinearLayout • Aligns all children in a single direction - vertically or horizontally • All children are stacked one after the other • Layout weight (android: layout_weight) assigns an "importance" value to a view in terms of how much space is should occupy on the screen
  • 38. Layout types RelativeLayout • view group that displays child views in relative positions • can eliminate nested view groups and keep your layout hierarchy flat, that improves performance • specify the location of child objects relative to each other (child A to the left of child B) or to the parent
  • 39. Layout Parameters Layout Parameters (layout_something) • parent view group defines layout parameters for each child view (including the child view group) • child element must define LayoutParams that are appropriate for its parent
  • 42. Want to host a workshop or presentation? gdgriga@gmail.com