android app performance tips

Post on 10-Feb-2017

263 Views

Category:

Mobile

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Android App Performance Tips

Lê Văn Giáp

Why ?Smooth

responsive

Why ?Keep battery

time

Coding tips Avoid Creating Unnecessary Objects Use Static Final For Constants Avoid Internal Getters/Setters Use Enhanced For Loop Syntax Avoid Using Floating-Point Create package Instead of private Inner

Classes

Read more at: http://developer.android.com/

Use Enhanced For Loop Syntax

UI tips Re-using layout with <include />

UI tips<merge/>

UI tips Loading views on demand <ViewStub/>

UI tipsSmooth scrolling ListView – (AsyncTask)

UI tips Smooth scrolling ListView – (ViewHolder)

…in getView(….)

UI tipsSmooth scrolling ListView

RecyclerView

RecyclerView.ViewHolderRecyclerView.Adapter

Instead of basic ListView

UI tips Smooth loading image

Lazy load

AsyncTask

File caching

UI tips Monitor, Tracking tool

Memory monitor

Allocatio tracker

Heap viewerSystrace

top related