More Related Content Similar to 10 commandments for better android development Similar to 10 commandments for better android development (20) 10 commandments for better android development2. 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..
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
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)
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)
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";"
}
}
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