SlideShare a Scribd company logo
1 of 18
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

What's hot

Android study jams 1
Android study jams 1Android study jams 1
Android study jams 1NancyMariaAS
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming BasicsEueung Mulyana
 
Android Programming made easy
Android Programming made easyAndroid Programming made easy
Android Programming made easyLars Vogel
 
Basic android development
Basic android developmentBasic android development
Basic android developmentUpanya Singh
 
Android Programming Seminar
Android Programming SeminarAndroid Programming Seminar
Android Programming SeminarNhat Nguyen
 
Android development basics
Android development basicsAndroid development basics
Android development basicsPramesh Gautam
 
Android Overview
Android OverviewAndroid Overview
Android OverviewRaju Kadam
 
Project a day 2 introduction to android studio
Project a day 2   introduction to android studioProject a day 2   introduction to android studio
Project a day 2 introduction to android studioGoran Djonovic
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application DevelopmentBenny Skogberg
 
Generating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving PerformanceGenerating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving PerformanceParesh Mayani
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Developmentdonnfelker
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Javaamaankhan
 
Anroid Tutorial Beginner level By SAMRAT TAYADE
Anroid Tutorial Beginner level By SAMRAT TAYADE Anroid Tutorial Beginner level By SAMRAT TAYADE
Anroid Tutorial Beginner level By SAMRAT TAYADE Samrat Tayade
 
Android development training
Android development trainingAndroid development training
Android development trainingmaheswarimahi18
 
Project proposal android operating system
Project proposal android operating systemProject proposal android operating system
Project proposal android operating systemAttiq12
 

What's hot (20)

Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android study jams 1
Android study jams 1Android study jams 1
Android study jams 1
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming Basics
 
Android Programming made easy
Android Programming made easyAndroid Programming made easy
Android Programming made easy
 
Basic android development
Basic android developmentBasic android development
Basic android development
 
Android Programming Seminar
Android Programming SeminarAndroid Programming Seminar
Android Programming Seminar
 
Android development basics
Android development basicsAndroid development basics
Android development basics
 
Android Overview
Android OverviewAndroid Overview
Android Overview
 
Project a day 2 introduction to android studio
Project a day 2   introduction to android studioProject a day 2   introduction to android studio
Project a day 2 introduction to android studio
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
 
Gdsc android introduction
Gdsc android introductionGdsc android introduction
Gdsc android introduction
 
Generating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving PerformanceGenerating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving Performance
 
Intro to Android Programming
Intro to Android ProgrammingIntro to Android Programming
Intro to Android Programming
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android session-1-sajib
Android session-1-sajibAndroid session-1-sajib
Android session-1-sajib
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Java
 
Anroid Tutorial Beginner level By SAMRAT TAYADE
Anroid Tutorial Beginner level By SAMRAT TAYADE Anroid Tutorial Beginner level By SAMRAT TAYADE
Anroid Tutorial Beginner level By SAMRAT TAYADE
 
Android development training
Android development trainingAndroid development training
Android development training
 
Android studio
Android studioAndroid studio
Android studio
 
Project proposal android operating system
Project proposal android operating systemProject proposal android operating system
Project proposal android operating system
 

Viewers also liked

Android Fragment Pattern: Communication
Android Fragment Pattern: CommunicationAndroid Fragment Pattern: Communication
Android Fragment Pattern: Communicationzmontesd
 
Spinners, Adapters & Fragment Communication
Spinners, Adapters & Fragment CommunicationSpinners, Adapters & Fragment Communication
Spinners, Adapters & Fragment CommunicationCITSimon
 
Android App Development - 06 Fragments
Android App Development - 06 FragmentsAndroid App Development - 06 Fragments
Android App Development - 06 FragmentsDiego Grancini
 
Android - Working with Fragments
Android - Working with FragmentsAndroid - Working with Fragments
Android - Working with FragmentsCan Elmas
 
Screen orientations in android
Screen orientations in androidScreen orientations in android
Screen orientations in androidmanjakannar
 
Short Intro to Android Fragments
Short Intro to Android FragmentsShort Intro to Android Fragments
Short Intro to Android FragmentsJussi Pohjolainen
 
Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Khaled Anaqwa
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android FragmentsSergi Martínez
 
Fragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed DatabaseFragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed DatabaseAbhilasha Lahigude
 

Viewers also liked (10)

Android Fragment Pattern: Communication
Android Fragment Pattern: CommunicationAndroid Fragment Pattern: Communication
Android Fragment Pattern: Communication
 
Spinners, Adapters & Fragment Communication
Spinners, Adapters & Fragment CommunicationSpinners, Adapters & Fragment Communication
Spinners, Adapters & Fragment Communication
 
Android App Development - 06 Fragments
Android App Development - 06 FragmentsAndroid App Development - 06 Fragments
Android App Development - 06 Fragments
 
Android - Working with Fragments
Android - Working with FragmentsAndroid - Working with Fragments
Android - Working with Fragments
 
Screen orientations in android
Screen orientations in androidScreen orientations in android
Screen orientations in android
 
Short Intro to Android Fragments
Short Intro to Android FragmentsShort Intro to Android Fragments
Short Intro to Android Fragments
 
Fragment
Fragment Fragment
Fragment
 
Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)Android Training (Storing & Shared Preferences)
Android Training (Storing & Shared Preferences)
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android Fragments
 
Fragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed DatabaseFragmentation and types of fragmentation in Distributed Database
Fragmentation and types of fragmentation in Distributed Database
 

Similar to Android 101 - Introduction to Android Development

Android Introduction
Android IntroductionAndroid Introduction
Android Introductionaswapnal
 
Android OS & SDK - Getting Started
Android OS & SDK - Getting StartedAndroid OS & SDK - Getting Started
Android OS & SDK - Getting StartedHemant Chhapoliya
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalNAVER D2
 
Announcing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAnnouncing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAmazon Web Services
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...Dicoding
 
Introduction to Android- A session by Sagar Das
Introduction to Android-  A session by Sagar DasIntroduction to Android-  A session by Sagar Das
Introduction to Android- A session by Sagar Dasdscfetju
 
Writing Android Libraries
Writing Android LibrariesWriting Android Libraries
Writing Android Librariesemanuelez
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_authlzongren
 
Dev days 1 Introduction to Xamarin Taswar Bhatti
Dev days 1 Introduction to Xamarin Taswar BhattiDev days 1 Introduction to Xamarin Taswar Bhatti
Dev days 1 Introduction to Xamarin Taswar BhattiTaswar Bhatti
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Nicolas HAAN
 
Droidcon uk2012 androvm
Droidcon uk2012 androvmDroidcon uk2012 androvm
Droidcon uk2012 androvmdfages
 
Multithreading in Android
Multithreading in AndroidMultithreading in Android
Multithreading in Androidcoolmirza143
 
Android Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start GuideAndroid Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start GuideSergii Zhuk
 
Android application development
Android application developmentAndroid application development
Android application developmentslidesuren
 
Ionic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile appsIonic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile appsAndreas Sahle
 

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

Android Introduction
Android IntroductionAndroid Introduction
Android Introduction
 
Android OS & SDK - Getting Started
Android OS & SDK - Getting StartedAndroid OS & SDK - Getting Started
Android OS & SDK - Getting Started
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_final
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Announcing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAnnouncing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck Talks
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
 
AWS Code Services
AWS Code ServicesAWS Code Services
AWS Code Services
 
Introduction to Android- A session by Sagar Das
Introduction to Android-  A session by Sagar DasIntroduction to Android-  A session by Sagar Das
Introduction to Android- A session by Sagar Das
 
Writing Android Libraries
Writing Android LibrariesWriting Android Libraries
Writing Android Libraries
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Core Android
Core AndroidCore Android
Core Android
 
Dev days 1 Introduction to Xamarin Taswar Bhatti
Dev days 1 Introduction to Xamarin Taswar BhattiDev days 1 Introduction to Xamarin Taswar Bhatti
Dev days 1 Introduction to Xamarin Taswar Bhatti
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
 
Droidcon uk2012 androvm
Droidcon uk2012 androvmDroidcon uk2012 androvm
Droidcon uk2012 androvm
 
Multithreading in Android
Multithreading in AndroidMultithreading in Android
Multithreading in Android
 
Session 2 beccse
Session 2 beccseSession 2 beccse
Session 2 beccse
 
Android Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start GuideAndroid Applications Development: A Quick Start Guide
Android Applications Development: A Quick Start Guide
 
Android application development
Android application developmentAndroid application development
Android application development
 
Introduction to xamarin
Introduction to xamarinIntroduction to xamarin
Introduction to xamarin
 
Ionic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile appsIonic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile apps
 

Recently uploaded

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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Recently uploaded (20)

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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

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

  1. 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).