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
69
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
110
Continuous integration and deployment on Android (plus some sweets)
reisub
1
400
Continuous integration and deployment on Android
reisub
0
200
Other Decks in Programming
See All in Programming
"config" ってなんだ? / What is "config"?
okashoi
0
210
Introduction for Open Source Swift Workshop
giginet
PRO
0
1.1k
エンターテイメント業界で利用されるAWS
demuyan
0
200
try!Swift Tokyo 2024 参加報告 LT
akidon0000
1
190
Build with AI 2024 Seoul - 제로부터 시작하는 Flutter with Gemini 생활 - 박제창
itsmedreamwalker
0
200
ログラスを支える設計標準について / loglass-design-standards
urmot
10
2.1k
Elm 0.19.0 Changes
bkuhlmann
0
480
Front-end application development, Symfony-style(s)
dunglas
2
1.9k
1인 개발자로 행복하게 살기 - GDG 송도 헬로월드 2024
benjaminkim
1
5.6k
Folding Cheat Sheet #3
philipschwarz
PRO
0
110
オブジェクト指向のリ・オリエンテーション~歴史を振り返り、AI時代に向きなおる~
hanyudaeiiti
9
5.6k
PHPの次期バージョンはこの時期どうなっているのか - Internalsの開発体制について - PHPカンファレンス小田原
youkidearitai
PRO
1
180
Featured
See All Featured
What the flash - Photography Introduction
edds
64
11k
Become a Pro
speakerdeck
PRO
9
4.5k
Teambox: Starting and Learning
jrom
128
8.4k
GitHub's CSS Performance
jonrohan
1023
450k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
13
1.5k
Designing for humans not robots
tammielis
247
25k
How to name files
jennybc
64
92k
How GitHub Uses GitHub to Build GitHub
holman
468
290k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
Why You Should Never Use an ORM
jnunemaker
PRO
50
8.6k
Pencils Down: Stop Designing & Start Developing
hursman
116
11k
Designing on Purpose - Digital PM Summit 2013
jponch
110
6.4k
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