15
Android App Performance Tips Lê Văn Giáp

Android App Performance Tips

Embed Size (px)

Citation preview

Page 1: Android App Performance Tips

Android App Performance Tips

Lê Văn Giáp

Page 2: Android App Performance Tips

Why ?Smooth

responsive

Page 3: Android App Performance Tips

Why ?Keep battery

time

Page 4: Android App Performance Tips

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/

Page 5: Android App Performance Tips

Use Enhanced For Loop Syntax

Page 6: Android App Performance Tips

UI tips Re-using layout with <include />

Page 7: Android App Performance Tips

UI tips<merge/>

Page 8: Android App Performance Tips

UI tips Loading views on demand <ViewStub/>

Page 9: Android App Performance Tips

UI tipsSmooth scrolling ListView – (AsyncTask)

Page 10: Android App Performance Tips

UI tips Smooth scrolling ListView – (ViewHolder)

…in getView(….)

Page 11: Android App Performance Tips

UI tipsSmooth scrolling ListView

RecyclerView

RecyclerView.ViewHolderRecyclerView.Adapter

Instead of basic ListView

Page 12: Android App Performance Tips

UI tips Smooth loading image

Lazy load

AsyncTask

File caching

Page 13: Android App Performance Tips

UI tips Monitor, Tracking tool

Memory monitor

Allocatio tracker

Heap viewerSystrace