SlideShare a Scribd company logo
10 Commandments for Better Android
Development
Trey Robinson
Thou shalt pick a reasonable min sdk version.
(9 is not reasonable)
(14 isn’t either)
Choosing a Min SDK
Choosing a Min SDK
● Froyo + Gingerbread + ICS = 8.7%
● Users with older OS versions download
fewer applications.
● Newer features and better phones often
mean faster time to market with a better
product.
So my Min SDK should be….
19(Seriously)
(If you must go lower.. 16)
Thou shalt not write boilerplate code.
(Ain’t nobody got time for that)
● View inflation
● OnClick, OnItemSelected.. etc etc
● Saving state
● Parcelables
Things you should understand..
Never write them again...
Old WayNew Way
And OnClicks...
Icepick and Saving State..
Parcelables
Automatic Parcelables
● Parcelable Plugin
○ https://github.com/mcharmas/android-parcelable-intellij-plugin
● Auto Parcel
○ https://github.com/frankiesardo/auto-parcel
● Parceler
○ https://github.com/johncarl81/parceler
Know thy IDE
You companion on the path to speed and
agility
● Control + R
● Control + D
● ⌘ + Shift + O
● ⌘ + Shift + Up/Down
● ⌘ + Option + Up/Down
● ⌘ + Shift + f
Useful Hotkeys
Live Templates
(Demo)
https://github.com/keyboardsurfer/idea-live-templates
MORE LIVE TEMPLATES
Thou shalt not consume REST APIs with
AsyncTasks
(Unless you are a masochist)
Retrofit vs Volley vs AsyncTask
Thou shalt read Effective
Java.
Some useful stuff..
● Factory vs Constructors
● Builders
● Singletons
● equals and hashCode
● toString
● Class accessibility
● Mutability
● Composition vs Inheritance
● Interfaces vs Abstract Classes
● Generics
● Lists vs Arrays
● Enum vs int constants
● Overloading
● Javadoc
● loops
● String concatenation
● Exceptions
● Concurrency
Thou shalt not ask permission when an
Intent will do.
(or how to avoid upsetting your users)
<uses-permission android:name="android.permission.SEND_SMS" />
Example: Sending an SMS
Option One:
Option Two:
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setData(Uri.parse("sms:" + telephoneNumber));
sendIntent.putExtra("sms_body", x);
startActivity(sendIntent);
Thou shalt understand
your builds.
(and make them faster and more useful)
● Manifest Mergers
● A little bit of Groovy
● Sweet debug settings
Things to Learn
For example..
<application android:vmSafeMode="true">
Added to the manifest in debug/src/AndroidManifest.xml
Environment Variables
buildTypes {
debug {
buildConfigField "String", "BASE_URL", ""https://myserver-dev.herokuapp.com";"
}
qa {
buildConfigField "String", "BASE_URL", ""https://myserver-qa.herokuapp.com";"
signingConfig signingConfigs.debug
}
support {
buildConfigField "String", "BASE_URL", ""https://myserver-support.herokuapp.com";"
signingConfig signingConfigs.debug
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
buildConfigField "String", "BASE_URL", ""https://www.myserver.com";"
}
}
(a what?)
Thou shalt use an activity
alias for your launcher
<activity android:name=".Launcher" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Like so..
<activity-alias
android:name=".Launcher"
android:targetActivity=".ui.MyNewLauncher" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity android:name=".ui.MyNewLauncher" />
Thou shalt stand on the
shoulders of giants.
(Or how to increase your knowledge in 3
easy steps.)
1. Attend meetups! (DONE)
2. Leverage cool libraries and techniques for
fun and profit.
3. Follow people on twitter.
So Easy...
Cool Libraries
● RXJava
● Dagger / Dagger 2
● Picasso / Universal Image Loader / Glide
● Design Support Library
● Pocket Knife
● Realm
● Stetho
Twitter Follows
● Jake Wharton @JakeWharton
● Dan Lew @danlew42
● Chet Haase @chethaase
● And many many many more...
https://twitter.com/rdrobinson3/lists/android
THE END

More Related Content

Viewers also liked (12)

PPTX
Rethinking Best Practices
floydophone
 
PDF
Kicking the Bukkit: Anatomy of an open source meltdown
RyanMichela
 
KEY
Object Calisthenics Applied to PHP
Guilherme Blanco
 
PDF
Clean code
Bulat Shakirzyanov
 
PDF
Integrating React.js with PHP projects
Ignacio Martín
 
PDF
How to Design Indexes, Really
Karwin Software Solutions LLC
 
PDF
Enterprise PHP: mappers, models and services
Aaron Saray
 
PDF
From development environments to production deployments with Docker, Compose,...
Jérôme Petazzoni
 
PDF
Enterprise PHP Architecture through Design Patterns and Modularization (Midwe...
Aaron Saray
 
PDF
Functional Programming Patterns (BuildStuff '14)
Scott Wlaschin
 
PDF
From Idea to Execution: Spotify's Discover Weekly
Chris Johnson
 
PDF
Linux Profiling at Netflix
Brendan Gregg
 
Rethinking Best Practices
floydophone
 
Kicking the Bukkit: Anatomy of an open source meltdown
RyanMichela
 
Object Calisthenics Applied to PHP
Guilherme Blanco
 
Clean code
Bulat Shakirzyanov
 
Integrating React.js with PHP projects
Ignacio Martín
 
How to Design Indexes, Really
Karwin Software Solutions LLC
 
Enterprise PHP: mappers, models and services
Aaron Saray
 
From development environments to production deployments with Docker, Compose,...
Jérôme Petazzoni
 
Enterprise PHP Architecture through Design Patterns and Modularization (Midwe...
Aaron Saray
 
Functional Programming Patterns (BuildStuff '14)
Scott Wlaschin
 
From Idea to Execution: Spotify's Discover Weekly
Chris Johnson
 
Linux Profiling at Netflix
Brendan Gregg
 

Similar to 10 commandments for better android development (20)

PDF
Learning Android 1st Edition Marko Gargenta
desiovissio
 
PPT
Part 2 android application development 101
Michael Angelo Rivera
 
PDF
Android Deep Dive
Marko Gargenta
 
PDF
Android application development
slidesuren
 
PPT
Android activity, service, and broadcast recievers
Jagdish Gediya
 
PPT
Android Application Development Using Java
amaankhan
 
PPTX
Sumbited by heena saini
Saini Heena
 
PDF
Learning Android 1st Edition Marko Gargenta
ellykarman17
 
PDF
Programming Android Zigurd Mednieks Laird Dornin Blake Meike
amdrupelstan
 
PDF
Programming Android Java Programming for the New Generation of Mobile Devices...
huftonjridi85
 
PDF
Android Development
vishalkrv
 
PDF
Blake Nakamura Masumi Programming Android 2nd Edition Mednieks Zigurd
nadericevriz
 
PDF
Programming Android Java Programming for the New Generation of Mobile Devices...
ahuzabakhla
 
PDF
Introduction to Android - Mobile Portland
sullis
 
KEY
Android Development: The Basics
Mike Desjardins
 
PPTX
Android Applications Development: A Quick Start Guide
Sergii Zhuk
 
PPTX
Android development orientation for starters v2
Joemarie Amparo
 
KEY
Android momobxl
Steven Palmaers
 
PPTX
Introduction to android
bantyder
 
PDF
Androidoscon20080721 1216843094441821-9
Gustavo Fuentes Zurita
 
Learning Android 1st Edition Marko Gargenta
desiovissio
 
Part 2 android application development 101
Michael Angelo Rivera
 
Android Deep Dive
Marko Gargenta
 
Android application development
slidesuren
 
Android activity, service, and broadcast recievers
Jagdish Gediya
 
Android Application Development Using Java
amaankhan
 
Sumbited by heena saini
Saini Heena
 
Learning Android 1st Edition Marko Gargenta
ellykarman17
 
Programming Android Zigurd Mednieks Laird Dornin Blake Meike
amdrupelstan
 
Programming Android Java Programming for the New Generation of Mobile Devices...
huftonjridi85
 
Android Development
vishalkrv
 
Blake Nakamura Masumi Programming Android 2nd Edition Mednieks Zigurd
nadericevriz
 
Programming Android Java Programming for the New Generation of Mobile Devices...
ahuzabakhla
 
Introduction to Android - Mobile Portland
sullis
 
Android Development: The Basics
Mike Desjardins
 
Android Applications Development: A Quick Start Guide
Sergii Zhuk
 
Android development orientation for starters v2
Joemarie Amparo
 
Android momobxl
Steven Palmaers
 
Introduction to android
bantyder
 
Androidoscon20080721 1216843094441821-9
Gustavo Fuentes Zurita
 
Ad

Recently uploaded (20)

PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
PDF
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PPTX
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
PPTX
Presentation 2.pptx AI-powered home security systems Secure-by-design IoT fr...
SoundaryaBC2
 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
Amity University, Patna
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PDF
smart lot access control system with eye
rasabzahra
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
Big Data and Data Science hype .pptx
SUNEEL37
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
PPTX
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
Presentation 2.pptx AI-powered home security systems Secure-by-design IoT fr...
SoundaryaBC2
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
Amity University, Patna
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
smart lot access control system with eye
rasabzahra
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
Big Data and Data Science hype .pptx
SUNEEL37
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
Ad

10 commandments for better android development

  • 1. 10 Commandments for Better Android Development Trey Robinson
  • 2. Thou shalt pick a reasonable min sdk version. (9 is not reasonable) (14 isn’t either)
  • 4. Choosing a Min SDK ● Froyo + Gingerbread + ICS = 8.7% ● Users with older OS versions download fewer applications. ● Newer features and better phones often mean faster time to market with a better product.
  • 5. So my Min SDK should be…. 19(Seriously) (If you must go lower.. 16)
  • 6. Thou shalt not write boilerplate code. (Ain’t nobody got time for that)
  • 7. ● View inflation ● OnClick, OnItemSelected.. etc etc ● Saving state ● Parcelables Things you should understand..
  • 8. Never write them again... Old WayNew Way
  • 12. Automatic Parcelables ● Parcelable Plugin ○ https://github.com/mcharmas/android-parcelable-intellij-plugin ● Auto Parcel ○ https://github.com/frankiesardo/auto-parcel ● Parceler ○ https://github.com/johncarl81/parceler
  • 13. Know thy IDE You companion on the path to speed and agility
  • 14. ● Control + R ● Control + D ● ⌘ + Shift + O ● ⌘ + Shift + Up/Down ● ⌘ + Option + Up/Down ● ⌘ + Shift + f Useful Hotkeys
  • 17. Thou shalt not consume REST APIs with AsyncTasks (Unless you are a masochist)
  • 18. Retrofit vs Volley vs AsyncTask
  • 19. Thou shalt read Effective Java.
  • 20. Some useful stuff.. ● Factory vs Constructors ● Builders ● Singletons ● equals and hashCode ● toString ● Class accessibility ● Mutability ● Composition vs Inheritance ● Interfaces vs Abstract Classes ● Generics ● Lists vs Arrays ● Enum vs int constants ● Overloading ● Javadoc ● loops ● String concatenation ● Exceptions ● Concurrency
  • 21. Thou shalt not ask permission when an Intent will do. (or how to avoid upsetting your users)
  • 22. <uses-permission android:name="android.permission.SEND_SMS" /> Example: Sending an SMS Option One: Option Two: Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.setData(Uri.parse("sms:" + telephoneNumber)); sendIntent.putExtra("sms_body", x); startActivity(sendIntent);
  • 23. Thou shalt understand your builds. (and make them faster and more useful)
  • 24. ● Manifest Mergers ● A little bit of Groovy ● Sweet debug settings Things to Learn
  • 25. For example.. <application android:vmSafeMode="true"> Added to the manifest in debug/src/AndroidManifest.xml
  • 26. Environment Variables buildTypes { debug { buildConfigField "String", "BASE_URL", ""https://myserver-dev.herokuapp.com";" } qa { buildConfigField "String", "BASE_URL", ""https://myserver-qa.herokuapp.com";" signingConfig signingConfigs.debug } support { buildConfigField "String", "BASE_URL", ""https://myserver-support.herokuapp.com";" signingConfig signingConfigs.debug } release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt' buildConfigField "String", "BASE_URL", ""https://www.myserver.com";" } }
  • 27. (a what?) Thou shalt use an activity alias for your launcher
  • 28. <activity android:name=".Launcher" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> Like so.. <activity-alias android:name=".Launcher" android:targetActivity=".ui.MyNewLauncher" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity-alias> <activity android:name=".ui.MyNewLauncher" />
  • 29. Thou shalt stand on the shoulders of giants. (Or how to increase your knowledge in 3 easy steps.)
  • 30. 1. Attend meetups! (DONE) 2. Leverage cool libraries and techniques for fun and profit. 3. Follow people on twitter. So Easy...
  • 31. Cool Libraries ● RXJava ● Dagger / Dagger 2 ● Picasso / Universal Image Loader / Glide ● Design Support Library ● Pocket Knife ● Realm ● Stetho
  • 32. Twitter Follows ● Jake Wharton @JakeWharton ● Dan Lew @danlew42 ● Chet Haase @chethaase ● And many many many more... https://twitter.com/rdrobinson3/lists/android