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
500
Continuous integration and deployment on Android
reisub
0
220
Other Decks in Programming
See All in Programming
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
770
Go の GC の不得意な部分を克服したい
taiyow
2
770
Security_for_introducing_eBPF
kentatada
0
110
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
1
560
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
たのしいparse.y
ydah
3
120
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
130
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
890
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
Featured
See All Featured
Designing for Performance
lara
604
68k
Designing Experiences People Love
moore
138
23k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
The Invisible Side of Design
smashingmag
298
50k
Rails Girls Zürich Keynote
gr2m
94
13k
A designer walks into a library…
pauljervisheath
204
24k
GraphQLとの向き合い方2022年版
quramy
44
13k
Fireside Chat
paigeccino
34
3.1k
Documentation Writing (for coders)
carmenintech
66
4.5k
Automating Front-end Workflow
addyosmani
1366
200k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
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