Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kickstart your Android development
Search
Dino Kovač
March 24, 2016
Programming
1
75
Kickstart your Android development
Presentation / workshop for App Start Contest
Dino Kovač
March 24, 2016
Tweet
Share
More Decks by Dino Kovač
See All by Dino Kovač
Developing an Android library
reisub
0
130
Continuous integration and deployment on Android (plus some sweets)
reisub
1
490
Continuous integration and deployment on Android
reisub
0
220
Other Decks in Programming
See All in Programming
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
290
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.3k
CSC509 Lecture 11
javiergs
PRO
0
180
みんなでプロポーザルを書いてみた
yuriko1211
0
260
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
2
660
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Practical Orchestrator
shlominoach
186
10k
Why Our Code Smells
bkeepers
PRO
334
57k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Unsuck your backbone
ammeep
668
57k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
A Tale of Four Properties
chriscoyier
156
23k
Transcript
Kickstart your Android development DINO KOVAČ ANDROID TEAM LEAD
ABOUT INFINUM • independent design and development agency • 90
employees • 15 Android Engineers • hundreds of projects
01 ANDROID STUDIO 2.0
SHORTCUTS • CTRL + SHIFT + A → find action
• SHIFT + F6 → rename • ALT + F7 → find usages • CTRL + SHIFT + O → open file
DEBUGGER
EVALUATE EXPRESSION
PROFILING TOOLS • find bottlenecks in the app • identify
memory leaks
None
None
02 ANDROID EMULATOR 2.0
None
03 DEBUGGING LAYOUTS
DEVELOPER TOOLS ON DEVICE • to enable press build number
7 times (Settings - About phone) • you get a bunch of useful options
None
None
HIERARCHY VIEWER • inspect your view hierarchy at runtime •
profile measure/layout/draw and find bottlenecks • comes with Android SDK
None
04 LIBRARIES
GLIDE • simple image loading library • built-in caching •
animated gifs! • https://github.com/bumptech/glide Glide.with(this).load("http://goo.gl/gEgYUd").into(imageView);
OKHTTP • fast, well-tested and maintained http client • many
features (spdy and http/2 support, websockets, …) • nice API (as opposed to HttpURLConnection) • http://square.github.io/okhttp/
GSON • JSON (de)serialization library from Google • Java objects
<=> JSON string
{ "id": "2GC3t5Un6d1BEF5a6BTYo05jYCfv7OYcLvAJqxwRGPxT8xH1oY9ivM7uBFoY5Cvf", "ttl": 1209600, "userId": "565dc7fe6ebcd2f77e040728" }
public class LoginResponse implements Serializable { @SerializedName("id") private String
accessToken; @SerializedName("userId") private String userId; @SerializedName("ttl") private int timeToLive; public String getAccessToken() { return accessToken; } public String getUserId() { return userId; } public int getTimeToLive() { return timeToLive; } }
RETROFIT • ‘turns your HTTP API into a Java interface’
• http://square.github.io/retrofit/
public interface ApiService { @POST("/api/users/login") Call<LoginResponse> authenticateUser(@Body LoginRequest loginRequest);
@POST("/api/users") Call<RegisterResponse> registerUser(@Body RegisterRequest registerRequest); @GET("/api/users/{userId}/timezones") Call<List<Timezone>> getTimezones(@Path("userId") String userId); @DELETE("/api/users/{userId}/timezones/{timezoneId}") Call<Void> deleteTimezone(@Path("userId") String userId, @Path("timezoneId") String timezoneId); @POST("/api/users/{userId}/timezones") Call<Void> createTimezone(@Path("userId") String userId, @Body Timezone timezone); @GET("/api/users") Call<List<User>> getUsers(); @PUT("/api/users/{userId}") Call<User> updateUser(@Path("userId") String userId, @Body User user); @DELETE("/api/users/{userId}") Call<Void> deleteUser(@Path("userId") String userId); @GET("/api/users/{userId}/roles") Call<List<UserRole>> getUserRoles(@Path("userId") String userId); }
BUTTERKNIFE • reduces boilerplate code to get view references •
generates similar code to what you would write • also does resource binding (strings, drawables, colors, …) • http://jakewharton.github.io/butterknife/
WITHOUT BUTTERKNIFE TextView helloText; TextView secondHelloText; @Override protected void onCreate(Bundle
savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); secondHelloText = (TextView) findViewById(R.id.text_hello2); secondHelloText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO } }); helloText = (TextView) findViewById(R.id.text_hello); // TODO }
WITH BUTTERKNIFE // build.gradle compile 'com.jakewharton:butterknife:7.0.1' // MainActivity.java @Bind(R.id.text_hello2) TextView
secondHelloText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); // TODO } @OnClick(R.id.text_hello) protected void onHelloClicked() { // TODO }
HUGO • Annotation-triggered method call logging • https://github.com/JakeWharton/hugo @DebugLog public
String getName() { return name; } V/EXAMPLE: ⇢ GETNAME() V/EXAMPLE: ⇠ GETNAME [0MS] = "JAKE WHARTON"
DBFLOW • ORM library with annotation processing • generates code
for interaction with SQLite databases so you don’t have to write it by hand
None
DBINSPECTOR • adds additional launcher icon for viewing db contents
and schema • great for debugging db issues • https://github.com/infinum/android_dbinspector/
None
THREETEN-ABP • backport of the new Date API introduced in
Java 8 (JSR-310) • https://github.com/JakeWharton/ThreeTenABP
LEAK CANARY • automatically detect common classes of memory leaks
• https://github.com/square/leakcanary
MAGIC VIEWS • easily use custom fonts in your app
• https://github.com/ikocijan/MagicViews
05 STAYING UP TO DATE
• Jake Wharton • Reto Meier • Cyril Mottier •
Dan Lew • Chris Banes • Mark Murphy • Mark Allison PEOPLE TO FOLLOW
NEWSLETTERS TO READ • https://androidsweets.ongoodbits.com/ • http://androidweekly.net/
Use the source, Luke!
INFINUM ANDROID TALKS • http://www.meetup.com/Infinum-Android-Talks-Zagreb/ • new libs • practical
tips • a place to ask for advice • next event: 7.4.2016. at 18h CET (Strojarska 22)
REFERENCES • http://developer.android.com/sdk/installing/studio- tips.html • http://stackoverflow.com/questions/294167/what-are- the-most-useful-intellij-idea-keyboard-shortcuts • http://developer.android.com/tools/debugging/ debugging-ui.html
Any questions?
[email protected]
@DINO_BLACKSMITH Visit infinum.co or find us on
social networks: infinum.co infinumco infinumco infinum