SlideShare une entreprise Scribd logo
1  sur  52
Introduction to Android
     Development
         Can Elmas
        March 07, 2012
Who am I ?
• 2008 GSU graduate
• Software Development Team Leader at Pozitron
   – http://www.pozitron.com

• Interest in mobile platforms
• Experience with mobile platforms such as Symbian
  (Java ME), BlackBerry and Android
• Experience with server side development
Agenda

• What is Android?

• Why Android?

• Android Architecture

• Android Building Blocks

• Demo
What is Android ?
What is Android?
• Software stack for mobile devices including an
  operating system, middleware , key applications
  and rich set of APIs
• Project by Open Handset Alliance led by Google,
  a consortium of 86 companies (Samsung,
  Motorola, Sony, HTC, LG, Dell, Intel, Nvidia etc.)
• First Release in November 2007
What is Android?
• Based on Linux Kernel
• Security, Memory Management, Process Management,
  Network Stack, Driver stack
• No, Android is not Linux (No native windowing system, no
  glibc, no standard GNU/linux utilities)
• Linux Kernel enhancements (alarm, ashmem, power
  management, low memory killer - no swap space)
• Robust and proven over time
What is Android?
• Applications written primarily in customized version of
  Java
• No, android is not Java
   – Uses Java language
   – Implements part of the Java 5 SE specification
     (Collections, generics support)
   – Runs on Dalvik Virtual Machine instead of JVM
   – Multiple VMs
What is Android?
• Free and open
   – No need of any user id or account for SDK access
   – Source at http://source.android.com

• Rich Developer Community
• Cheaper and more innovative Mobile Devices
• Extendable
   – Players can add proprietary functionality to their products
   – Companies can remove functionality if they choose
What is Android?

• Android Market, 450.000 apps as of February
  2012
• 850.000 devices activated every day,
  according to Google’s Andy Rubin
What is Android?

• Mulitasking

• Integrated browser based on WebKit Engine

• 3d Graphics based on the OpenGL Es

• SQLite

• Camera, GPS, compass and accelerometer
Why Android?
Why Android?
• Free SDK
   – Available at http://developer.android.com

• Open Source
• All applications are equal
• Dalvik Virtual Machine
• Development on Windows, Linux or Mac OS
• Starting development easy and cheap
Why Android?
• Rich Development Environment
   – Full Device Emulator
   – Tools for debugging DDMS (Dalvik Debug Monitor Server)
   – Memory and performance profiling

• Rich Documentation
• Very large community and target audience
• Open Market Place
   – Instant publishing
Android Architecture
Android Architecture

• Relies on Linux kernel version 2.6 for core system services
• Every Android application runs on its own process, with its
  own Dalvik Virtual Machine
• C/C++ libraries (Surface Manager , Media Libraries, SQLite
  etc.)
• Native set of core applications including email client, SMS,
  Calendar, maps, browser, contacts and others
Android Building Blocks
Vocabulary
• Activity
• Views
• Resources
• Intents
• Intent Filters
• AndroidManifest.xml
Activity


• What the user see on the screen

• An Android application with User Interface
  consists of one or more Activities.
Activity
Activity
Activity

• Moving through screens is by starting new activities
• Managed as an activity stack
• LIFO (Last In First Out)
• Only one is visible
• Only one is active
• Activity Lifecycle
Source : http://developer.android.com
Activity States
• Active
   – At the top of the stack
• Paused
   – Lost focusbut still visible
   – Can be killed by Low Memory Killer
• Stopped
   – Not at the top of the stack
• Dropped
   – Killed to reclaim its memory
Activity




• An empty activity with no content
Views
• Views are basic UI building blocks
• They know how to draw themselves
   – Android framework responsible for measuring, laying out and drawing
• Respond to events
• Implementation :
   – Java code
   – XML
       – Separation of presentation of the application from the code controlling the
         behavior.
       – Ease of visualization of the UI structure
       – Strings, color, styles, shapes, animations etc can be described as XML
Views
• Views and view groups trees build up
 complex GUIs : widgets
  – android.widget.ListView

  – android.widget.TextView

  – android.widget.Button

  – android.widget.ImageView
Views
• Subclasses of ViewGroup, Layouts
• Standard layouts :
  – LinearLayout
  – FrameLayout
  – TableLayout
  – RelativeLayout
  – AbsoluteLayout
Views
• Android UI in XML : /res/layout/main_act.xml
Resources
• External sources other than your code
  (images, views and layouts in xml, strings
  etc.) should be externalized, so that you can
  maintain them independently
Resources

• Accessing application resources :
  – R class

• All reources IDs are defined in R class, which is
  automatically generated by Android aapt tool
Activity




• An empty activity with no content
Activity
Activity
Intents
• An Intention to do something
• Abstract description of an operation to be performed
• A message to the OS that you want to do something
  (pre-defined action)
• Used to move from one Activity to another
Intents
• Facilitates app to app communication
• Primary Attributes
  – Action
     • The general action to be performed

  – Data
     • The data to operate on (a contact, an url, the new activity
       etc.)
Intent Filters

• Description of what intent an activity is
  capable of handling
Intent Filters
AndroidManifest .xml

• Description of the android application including
  activities, intent receivers, permissions, application
  icon, application name, version information etc.
• It’s the glue that specifies which Intents your activities
  might receive
• An activity should be declared as the main entry point
AndroidManifest.xml
More Advanced Topics

• How Android deal with Fragmentation?
  – API Levels (Cupcake, Donut, Eclair, Froyo,
    Gingerbread, Honeycomb, Ice Cream Sandwich)

• How are the resources selected at run time
  according to different screen sizes and
  densities?
More Advanced Topics


• Single Threaded UI Model

• APK (Android Package)

• Application Signing
Thank you
• We’re Hiring
  – http://pozitron.com/careers.php
  – ik@pozitron.com

• Twitter
  – @foragoodpurpose
  – @Pozitron_Mobile
Demo
• Phase 1:
  – Create a new Android project with package name
    com.gsuandroid.activities
  – Create a new Activity called MainActivity
  – Create a layout for MainActivity which will consist
    of a LinearLayout containing a TextView with
    predefined text “Hello Android”
  – Run your application
Demo
• Phase 2:
   – Create another activity called ActTwo
   – Create a layout for your new activity containing a TextView
     without setting a text in XML
   – Modify your MainActivity’s layout xml in and add a Button with
     setting and id, android:id="@+id/btn_go_to_act_two » and text
     « Go to Next Activity»
   – Start ActTwo when user presses button inserted in the
     MainActivity
   – Run your application
Demo


• Phase 3:
  – Pass a text message “That’s it for today” when
    moving from MainActivity to ActTwo
  – Run your application
Full Code
main_act.xml
act_two.xml
Introduction to Android Development
Introduction to Android Development

Contenu connexe

Tendances

Tendances (20)

Software development life cycle
Software development life cycleSoftware development life cycle
Software development life cycle
 
Introduction To C#
Introduction To C#Introduction To C#
Introduction To C#
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For Syntax
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
 
Introduction of java
Introduction  of javaIntroduction  of java
Introduction of java
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
 
Java Object Oriented Programming
Java Object Oriented Programming Java Object Oriented Programming
Java Object Oriented Programming
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVA
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
.NET and C# Introduction
.NET and C# Introduction.NET and C# Introduction
.NET and C# Introduction
 
Jdbc
JdbcJdbc
Jdbc
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
Core java concepts
Core java  conceptsCore java  concepts
Core java concepts
 
Presentation on Visual Studio
Presentation on Visual StudioPresentation on Visual Studio
Presentation on Visual Studio
 

En vedette

Architecture pitfalls in android development
Architecture pitfalls in android developmentArchitecture pitfalls in android development
Architecture pitfalls in android developmentThomas Krueger
 
Introduction to Android development
Introduction to Android developmentIntroduction to Android development
Introduction to Android developmentTristan Roddis
 
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
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentSander Alberink
 
Windows Phone 8 - 5 Application Lifecycle
Windows Phone 8 - 5 Application LifecycleWindows Phone 8 - 5 Application Lifecycle
Windows Phone 8 - 5 Application LifecycleOliver Scheer
 

En vedette (6)

Architecture pitfalls in android development
Architecture pitfalls in android developmentArchitecture pitfalls in android development
Architecture pitfalls in android development
 
Introduction to Android development
Introduction to Android developmentIntroduction to Android development
Introduction to 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
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Windows Phone 8 - 5 Application Lifecycle
Windows Phone 8 - 5 Application LifecycleWindows Phone 8 - 5 Application Lifecycle
Windows Phone 8 - 5 Application Lifecycle
 

Similaire à Introduction to Android Development

Introduction to android
Introduction to androidIntroduction to android
Introduction to androidJawad Mohmand
 
Android development
Android developmentAndroid development
Android developmentmkpartners
 
Android Application Development GDSC DCE Darbhanga.pptx
Android Application Development GDSC DCE Darbhanga.pptxAndroid Application Development GDSC DCE Darbhanga.pptx
Android Application Development GDSC DCE Darbhanga.pptxDCETechnicalClub
 
Synapse india reviews on android application
Synapse india reviews on android applicationSynapse india reviews on android application
Synapse india reviews on android applicationsaritasingh19866
 
Android Workshop_1
Android Workshop_1Android Workshop_1
Android Workshop_1Purvik Rana
 
Android Application Development.pdf
Android Application Development.pdfAndroid Application Development.pdf
Android Application Development.pdfMohammedMuzammil99
 
Android app development
Android app developmentAndroid app development
Android app developmentTechizzaa
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.pptSumanKumarDey5
 
Android Application Development (2).ppt
Android Application Development (2).pptAndroid Application Development (2).ppt
Android Application Development (2).pptRKRahulKhatri
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.pptSumanKumarDey5
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.pptSarikaDontha1
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.pptSHUBHAMKENDRE5
 
Android application development
Android application developmentAndroid application development
Android application developmentMadhuprakashR1
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.pptTarunSharma506177
 
Android application development
Android application developmentAndroid application development
Android application developmentshanmukhashannu3
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.pptAyushThakur97
 
Android application development
Android application developmentAndroid application development
Android application developmentDewan Razib
 
Synapseindia android apps application development
Synapseindia android apps application developmentSynapseindia android apps application development
Synapseindia android apps application developmentSynapseindiappsdevelopment
 

Similaire à Introduction to Android Development (20)

Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android development
Android developmentAndroid development
Android development
 
Android Application Development GDSC DCE Darbhanga.pptx
Android Application Development GDSC DCE Darbhanga.pptxAndroid Application Development GDSC DCE Darbhanga.pptx
Android Application Development GDSC DCE Darbhanga.pptx
 
Synapse india reviews on android application
Synapse india reviews on android applicationSynapse india reviews on android application
Synapse india reviews on android application
 
Android Workshop_1
Android Workshop_1Android Workshop_1
Android Workshop_1
 
Android Application Development.pdf
Android Application Development.pdfAndroid Application Development.pdf
Android Application Development.pdf
 
Android app development
Android app developmentAndroid app development
Android app development
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.ppt
 
Android Application Development (2).ppt
Android Application Development (2).pptAndroid Application Development (2).ppt
Android Application Development (2).ppt
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.ppt
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.ppt
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.ppt
 
Android application development
Android application developmentAndroid application development
Android application development
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.ppt
 
Android application development
Android application developmentAndroid application development
Android application development
 
Android Application Development.ppt
Android Application Development.pptAndroid Application Development.ppt
Android Application Development.ppt
 
Android application development
Android application developmentAndroid application development
Android application development
 
Android Training
Android TrainingAndroid Training
Android Training
 
Google android os
Google android osGoogle android os
Google android os
 
Synapseindia android apps application development
Synapseindia android apps application developmentSynapseindia android apps application development
Synapseindia android apps application development
 

Dernier

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Dernier (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Introduction to Android Development

  • 1. Introduction to Android Development Can Elmas March 07, 2012
  • 2. Who am I ? • 2008 GSU graduate • Software Development Team Leader at Pozitron – http://www.pozitron.com • Interest in mobile platforms • Experience with mobile platforms such as Symbian (Java ME), BlackBerry and Android • Experience with server side development
  • 3. Agenda • What is Android? • Why Android? • Android Architecture • Android Building Blocks • Demo
  • 5. What is Android? • Software stack for mobile devices including an operating system, middleware , key applications and rich set of APIs • Project by Open Handset Alliance led by Google, a consortium of 86 companies (Samsung, Motorola, Sony, HTC, LG, Dell, Intel, Nvidia etc.) • First Release in November 2007
  • 6. What is Android? • Based on Linux Kernel • Security, Memory Management, Process Management, Network Stack, Driver stack • No, Android is not Linux (No native windowing system, no glibc, no standard GNU/linux utilities) • Linux Kernel enhancements (alarm, ashmem, power management, low memory killer - no swap space) • Robust and proven over time
  • 7. What is Android? • Applications written primarily in customized version of Java • No, android is not Java – Uses Java language – Implements part of the Java 5 SE specification (Collections, generics support) – Runs on Dalvik Virtual Machine instead of JVM – Multiple VMs
  • 8. What is Android? • Free and open – No need of any user id or account for SDK access – Source at http://source.android.com • Rich Developer Community • Cheaper and more innovative Mobile Devices • Extendable – Players can add proprietary functionality to their products – Companies can remove functionality if they choose
  • 9. What is Android? • Android Market, 450.000 apps as of February 2012 • 850.000 devices activated every day, according to Google’s Andy Rubin
  • 10. What is Android? • Mulitasking • Integrated browser based on WebKit Engine • 3d Graphics based on the OpenGL Es • SQLite • Camera, GPS, compass and accelerometer
  • 12. Why Android? • Free SDK – Available at http://developer.android.com • Open Source • All applications are equal • Dalvik Virtual Machine • Development on Windows, Linux or Mac OS • Starting development easy and cheap
  • 13. Why Android? • Rich Development Environment – Full Device Emulator – Tools for debugging DDMS (Dalvik Debug Monitor Server) – Memory and performance profiling • Rich Documentation • Very large community and target audience • Open Market Place – Instant publishing
  • 15.
  • 16. Android Architecture • Relies on Linux kernel version 2.6 for core system services • Every Android application runs on its own process, with its own Dalvik Virtual Machine • C/C++ libraries (Surface Manager , Media Libraries, SQLite etc.) • Native set of core applications including email client, SMS, Calendar, maps, browser, contacts and others
  • 18. Vocabulary • Activity • Views • Resources • Intents • Intent Filters • AndroidManifest.xml
  • 19. Activity • What the user see on the screen • An Android application with User Interface consists of one or more Activities.
  • 22. Activity • Moving through screens is by starting new activities • Managed as an activity stack • LIFO (Last In First Out) • Only one is visible • Only one is active • Activity Lifecycle
  • 24. Activity States • Active – At the top of the stack • Paused – Lost focusbut still visible – Can be killed by Low Memory Killer • Stopped – Not at the top of the stack • Dropped – Killed to reclaim its memory
  • 25. Activity • An empty activity with no content
  • 26. Views • Views are basic UI building blocks • They know how to draw themselves – Android framework responsible for measuring, laying out and drawing • Respond to events • Implementation : – Java code – XML – Separation of presentation of the application from the code controlling the behavior. – Ease of visualization of the UI structure – Strings, color, styles, shapes, animations etc can be described as XML
  • 27. Views • Views and view groups trees build up complex GUIs : widgets – android.widget.ListView – android.widget.TextView – android.widget.Button – android.widget.ImageView
  • 28. Views • Subclasses of ViewGroup, Layouts • Standard layouts : – LinearLayout – FrameLayout – TableLayout – RelativeLayout – AbsoluteLayout
  • 29. Views • Android UI in XML : /res/layout/main_act.xml
  • 30. Resources • External sources other than your code (images, views and layouts in xml, strings etc.) should be externalized, so that you can maintain them independently
  • 31. Resources • Accessing application resources : – R class • All reources IDs are defined in R class, which is automatically generated by Android aapt tool
  • 32. Activity • An empty activity with no content
  • 35. Intents • An Intention to do something • Abstract description of an operation to be performed • A message to the OS that you want to do something (pre-defined action) • Used to move from one Activity to another
  • 36. Intents • Facilitates app to app communication • Primary Attributes – Action • The general action to be performed – Data • The data to operate on (a contact, an url, the new activity etc.)
  • 37. Intent Filters • Description of what intent an activity is capable of handling
  • 39. AndroidManifest .xml • Description of the android application including activities, intent receivers, permissions, application icon, application name, version information etc. • It’s the glue that specifies which Intents your activities might receive • An activity should be declared as the main entry point
  • 41. More Advanced Topics • How Android deal with Fragmentation? – API Levels (Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwich) • How are the resources selected at run time according to different screen sizes and densities?
  • 42. More Advanced Topics • Single Threaded UI Model • APK (Android Package) • Application Signing
  • 43. Thank you • We’re Hiring – http://pozitron.com/careers.php – ik@pozitron.com • Twitter – @foragoodpurpose – @Pozitron_Mobile
  • 44. Demo • Phase 1: – Create a new Android project with package name com.gsuandroid.activities – Create a new Activity called MainActivity – Create a layout for MainActivity which will consist of a LinearLayout containing a TextView with predefined text “Hello Android” – Run your application
  • 45. Demo • Phase 2: – Create another activity called ActTwo – Create a layout for your new activity containing a TextView without setting a text in XML – Modify your MainActivity’s layout xml in and add a Button with setting and id, android:id="@+id/btn_go_to_act_two » and text « Go to Next Activity» – Start ActTwo when user presses button inserted in the MainActivity – Run your application
  • 46. Demo • Phase 3: – Pass a text message “That’s it for today” when moving from MainActivity to ActTwo – Run your application
  • 48.