SlideShare a Scribd company logo
Android 101
Introduction to Android
Development
Andy Scherzinger
Spare-time Android Dev
AndyScherzinger 28th Jan. 2016
Topics
• Dev Setup
• File System Structure
• Activities & Fragments
• Handle Fragmentation
• The little Things
Dev Setup
Tool
Chain
Java Language Gradle Build System Android Studio IDE
Android Studio icon CC BY 2.5 Google Inc.
Android Studio
Coding Environment & Debugger
SDK Manager
Gradle Integration
Android Device Monitor
Android Virtual Device Manager
Android Studio icon CC BY 2.5 Google Inc.
Code to Binary
Java Byte Code Java Byte Code
Java Source Code Java Source Code
Java
Compiler
Java
Compiler
Dalvik Byte Code
Dex
Compiler
Java Byte Code Dalvik Byte Code
Dalvik VM
Android Runtime (ART)
Java VM
https://github.com/devacademy/android-fundamental-one/blob/master/modules/stack.md
File System Structure
* Grid, List, UI Partials
• AndroidManifest.xml  your App‘s definition
• build.gradle,…  your build files
• src/java  douh! your implementation
• src/res
– anim  custom animations
– drawable  graphics (pixel, patch9, vector-xml, etc.)
– layout  XML Layouts for Activities, Fragments, *-Items
– menu  XML Menu Files
– raw  any non-specific files
– values  l18n resources, static (array) data, configurations
– xml  Preference Screen, Sync Adapter, etc.
Fragment Orchestration
Source: http://developer.android.com/training/basics/fragments/fragment-ui.html
Fragments are UI modules orchestrated via Activities
Fragment
A
Fragment
B
Fragment A Fragment B
Activity 1 Activity 1 Activity 2
Intent
Activities & Fragments
– Activity Lifecycle
Source: http://developer.android.com/training/basics/activity-lifecycle/starting.html
Created
Started
(visible)
Resumed
(visible)
Paused
(part. visible)
Stopped
(hidden)
Destroyed
onResume()
onStart()
onStart()
onDestroy()
onStop()
onPause()
onResume()
onRestart()
Android
1
2
3
• (1) Initialize UI
• (2) Checks (e.g. GPS enabled)
• (3) Activity running - Woohoo!
onCreate()
Activities & Fragments
– Activity State Save
Source: http://developer.android.com/training/basics/activity-lifecycle/recreating.html
Created Resumed
(visible)
Destroyed
onRestoreInstanceState()
onSaveInstanceState()
Android
2
3
1
• (1) save your state
• (2) / (3) restore the state
onCreate()
Resumed
(visible)
Fragmentation
Resolution
& Display Size
Android
Versions
http://opensignal.com/reports/2015/08/android-fragmentation/ - http://developer.android.com/about/dashboards/index.html
Target Versions and Sizes
• src/res
– drawable-hdpi-v11
 used for Android 11 and up
– layout-w600dp-land
 used in landscape w/ at least 600dp
width
Call Version depending code
• src/java
if (android.os.Build.VERSION.SDK_INT >=
android.os.Build.VERSION_CODES.HONEYCOMB) {
builder.setIconAttribute(android.R.attr.alertDialogIcon);
}…
Backwards Compatibility
via Support Lib
• Add libs to build.gradle
dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
}
…and hack away…
• UI: AppCompatButton, Drawer, Material Theme,
AppCompatDialog, …
• Functionality: e.g.
ContextCompat.checkSelfPermission
 Android M Permission System Implementation
Backwards Compatibility
via Support Lib
The (many) little Things…CodeUIMisc
• Use Support Lib right from the beginning
• Use Activities to manage Fragments
• Use Fragments to implement the UI
• onCreate is monitored by the Android Runtime and is part of the UI Thread
 time consuming work needs to be done asynchronously (!)
• Style UI via style xml files not via specific view attributes in layout xml files
• Define a color palette (colors.xml), same for dimensions (dimens.xml)
• Prefix layout files (activity_, fragment_, listItem_, …)
• Re-use elements using <include> (and <merge> in the to be included layout file)
• compileTarget is your Frenemy, test thoroughly
• Don‘t set maxSdkVersion
• Be specific about your dependencies (2.2.0 not 2.2.+)
• Don‘t use too many libs (65k method limit!)
• Launcher icon(s) in mipmap folder when generating separate APKs for diff. densities
Let‘s check out some code 
DEMO
Topics we didn‘t talk about…
• Network / Communication
• Persistence
• Service / AsyncTask / Loader / Event Bus
• Permission System
• Sensors
Some links to get you started…
• Android Tutorials:
– http://developer.android.com/training/index.html
– https://www.udacity.com/courses/android
• Helpful Github Projects
– https://github.com/android10/Android-CleanArchitecture
– https://github.com/ribot/android-guidelines
– https://github.com/txusballesteros/Android-Clean-Testing
– https://github.com/ribot/android-boilerplate
• Exemplary Apps on Github to play around
– https://github.com/WhisperSystems/Signal-Android
– https://github.com/owncloud/android
• Icons:
– https://materialdesignicons.com/

More Related Content

PPTX
Introduction to Android and Android Studio
PPTX
Arduino - Android Workshop Presentation
PPTX
Android
PPTX
Android Studio Overview
PDF
Android Presentation
PDF
Android studio 2.2 Tips and Tricks
PDF
Android Programming
PPTX
Introduction_to_android_and_android_studio
Introduction to Android and Android Studio
Arduino - Android Workshop Presentation
Android
Android Studio Overview
Android Presentation
Android studio 2.2 Tips and Tricks
Android Programming
Introduction_to_android_and_android_studio

What's hot (20)

PPT
Introduction to android
PPTX
Android study jams 1
PDF
Android Programming Basics
PPTX
Android Programming made easy
PPTX
Android Programming Seminar
PDF
Android development basics
PPTX
Android Overview
PPTX
Project a day 2 introduction to android studio
ZIP
Android Application Development
PPTX
Gdsc android introduction
PDF
Generating efficient APK by Reducing Size and Improving Performance
PPT
Intro to Android Programming
PPTX
Introduction to Android Development
PPTX
Android session-1-sajib
PPT
Android Application Development Using Java
PPTX
Anroid Tutorial Beginner level By SAMRAT TAYADE
PPTX
Android development training
PDF
Android studio
DOCX
Project proposal android operating system
PDF
Android development - the basics, MFF UK, 2014
Introduction to android
Android study jams 1
Android Programming Basics
Android Programming made easy
Android Programming Seminar
Android development basics
Android Overview
Project a day 2 introduction to android studio
Android Application Development
Gdsc android introduction
Generating efficient APK by Reducing Size and Improving Performance
Intro to Android Programming
Introduction to Android Development
Android session-1-sajib
Android Application Development Using Java
Anroid Tutorial Beginner level By SAMRAT TAYADE
Android development training
Android studio
Project proposal android operating system
Android development - the basics, MFF UK, 2014
Ad

Viewers also liked (10)

PDF
Android Fragment Pattern: Communication
PPTX
Spinners, Adapters & Fragment Communication
ODP
Android App Development - 06 Fragments
PDF
Android - Working with Fragments
PPSX
Screen orientations in android
PDF
Short Intro to Android Fragments
PPTX
PPTX
Android Training (Storing & Shared Preferences)
PPT
Introduction to Android Fragments
PPTX
Fragmentation and types of fragmentation in Distributed Database
Android Fragment Pattern: Communication
Spinners, Adapters & Fragment Communication
Android App Development - 06 Fragments
Android - Working with Fragments
Screen orientations in android
Short Intro to Android Fragments
Android Training (Storing & Shared Preferences)
Introduction to Android Fragments
Fragmentation and types of fragmentation in Distributed Database
Ad

Similar to Android 101 - Introduction to Android Development (20)

PDF
Android development first steps
PPTX
Applico Android Info Session at Columbia University
PDF
Android development - the basics, MFF UK, 2013
PPTX
Mobile Application Development
PDF
Android development - the basics, MFF UK, 2012
PPTX
Android crash course
PDF
Android 3.0 Portland Java User Group 2011-03-15
PDF
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
PDF
Android - Open Source Bridge 2011
PPTX
Dori waldman android _course_2
PDF
[PBO] Pertemuan 12 - Pemrograman Android
PDF
Android 3.1 - Portland Code Camp 2011
PPTX
Android apps development
PPTX
Consistent UI Across Android Devices
PPTX
Developing Android Apps
PPTX
Android101 - Intro and Basics
PPTX
Android Starting App Development
PPTX
Dori waldman android _course
PDF
Beating Android Fragmentation
PPTX
DevFest Sul 2014 - Android 4 lazy iOS Devs
Android development first steps
Applico Android Info Session at Columbia University
Android development - the basics, MFF UK, 2013
Mobile Application Development
Android development - the basics, MFF UK, 2012
Android crash course
Android 3.0 Portland Java User Group 2011-03-15
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Android - Open Source Bridge 2011
Dori waldman android _course_2
[PBO] Pertemuan 12 - Pemrograman Android
Android 3.1 - Portland Code Camp 2011
Android apps development
Consistent UI Across Android Devices
Developing Android Apps
Android101 - Intro and Basics
Android Starting App Development
Dori waldman android _course
Beating Android Fragmentation
DevFest Sul 2014 - Android 4 lazy iOS Devs

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Encapsulation theory and applications.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Approach and Philosophy of On baking technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Mobile App Security Testing_ A Comprehensive Guide.pdf
The AUB Centre for AI in Media Proposal.docx
Encapsulation theory and applications.pdf
cuic standard and advanced reporting.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
NewMind AI Weekly Chronicles - August'25 Week I
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Digital-Transformation-Roadmap-for-Companies.pptx
A Presentation on Artificial Intelligence
Advanced methodologies resolving dimensionality complications for autism neur...
Per capita expenditure prediction using model stacking based on satellite ima...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
MYSQL Presentation for SQL database connectivity
Approach and Philosophy of On baking technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

Android 101 - Introduction to Android Development

  • 1. Android 101 Introduction to Android Development Andy Scherzinger Spare-time Android Dev AndyScherzinger 28th Jan. 2016
  • 2. Topics • Dev Setup • File System Structure • Activities & Fragments • Handle Fragmentation • The little Things
  • 3. Dev Setup Tool Chain Java Language Gradle Build System Android Studio IDE Android Studio icon CC BY 2.5 Google Inc.
  • 4. Android Studio Coding Environment & Debugger SDK Manager Gradle Integration Android Device Monitor Android Virtual Device Manager Android Studio icon CC BY 2.5 Google Inc.
  • 5. Code to Binary Java Byte Code Java Byte Code Java Source Code Java Source Code Java Compiler Java Compiler Dalvik Byte Code Dex Compiler Java Byte Code Dalvik Byte Code Dalvik VM Android Runtime (ART) Java VM https://github.com/devacademy/android-fundamental-one/blob/master/modules/stack.md
  • 6. File System Structure * Grid, List, UI Partials • AndroidManifest.xml  your App‘s definition • build.gradle,…  your build files • src/java  douh! your implementation • src/res – anim  custom animations – drawable  graphics (pixel, patch9, vector-xml, etc.) – layout  XML Layouts for Activities, Fragments, *-Items – menu  XML Menu Files – raw  any non-specific files – values  l18n resources, static (array) data, configurations – xml  Preference Screen, Sync Adapter, etc.
  • 7. Fragment Orchestration Source: http://developer.android.com/training/basics/fragments/fragment-ui.html Fragments are UI modules orchestrated via Activities Fragment A Fragment B Fragment A Fragment B Activity 1 Activity 1 Activity 2 Intent
  • 8. Activities & Fragments – Activity Lifecycle Source: http://developer.android.com/training/basics/activity-lifecycle/starting.html Created Started (visible) Resumed (visible) Paused (part. visible) Stopped (hidden) Destroyed onResume() onStart() onStart() onDestroy() onStop() onPause() onResume() onRestart() Android 1 2 3 • (1) Initialize UI • (2) Checks (e.g. GPS enabled) • (3) Activity running - Woohoo! onCreate()
  • 9. Activities & Fragments – Activity State Save Source: http://developer.android.com/training/basics/activity-lifecycle/recreating.html Created Resumed (visible) Destroyed onRestoreInstanceState() onSaveInstanceState() Android 2 3 1 • (1) save your state • (2) / (3) restore the state onCreate() Resumed (visible)
  • 11. Target Versions and Sizes • src/res – drawable-hdpi-v11  used for Android 11 and up – layout-w600dp-land  used in landscape w/ at least 600dp width
  • 12. Call Version depending code • src/java if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { builder.setIconAttribute(android.R.attr.alertDialogIcon); }…
  • 13. Backwards Compatibility via Support Lib • Add libs to build.gradle dependencies { compile 'com.android.support:support-v4:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.android.support:appcompat-v7:23.1.1' }
  • 14. …and hack away… • UI: AppCompatButton, Drawer, Material Theme, AppCompatDialog, … • Functionality: e.g. ContextCompat.checkSelfPermission  Android M Permission System Implementation Backwards Compatibility via Support Lib
  • 15. The (many) little Things…CodeUIMisc • Use Support Lib right from the beginning • Use Activities to manage Fragments • Use Fragments to implement the UI • onCreate is monitored by the Android Runtime and is part of the UI Thread  time consuming work needs to be done asynchronously (!) • Style UI via style xml files not via specific view attributes in layout xml files • Define a color palette (colors.xml), same for dimensions (dimens.xml) • Prefix layout files (activity_, fragment_, listItem_, …) • Re-use elements using <include> (and <merge> in the to be included layout file) • compileTarget is your Frenemy, test thoroughly • Don‘t set maxSdkVersion • Be specific about your dependencies (2.2.0 not 2.2.+) • Don‘t use too many libs (65k method limit!) • Launcher icon(s) in mipmap folder when generating separate APKs for diff. densities
  • 16. Let‘s check out some code  DEMO
  • 17. Topics we didn‘t talk about… • Network / Communication • Persistence • Service / AsyncTask / Loader / Event Bus • Permission System • Sensors
  • 18. Some links to get you started… • Android Tutorials: – http://developer.android.com/training/index.html – https://www.udacity.com/courses/android • Helpful Github Projects – https://github.com/android10/Android-CleanArchitecture – https://github.com/ribot/android-guidelines – https://github.com/txusballesteros/Android-Clean-Testing – https://github.com/ribot/android-boilerplate • Exemplary Apps on Github to play around – https://github.com/WhisperSystems/Signal-Android – https://github.com/owncloud/android • Icons: – https://materialdesignicons.com/

Editor's Notes

  • #6: Dalvik makes use of JIT (just in time) compilation. Thus each time the app is run, the part of the code required for its execution is going to becompiled to machine code at that moment. ART compiles the Dalvik bytecode into a system-dependent binary during install (thus only once).