Tech Talk #2: Android app performance tips

Post on 14-Apr-2017

413 views 0 download

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 tips Smooth scrolling ListView – (AsyncTask)

UI tips Smooth scrolling ListView – (ViewHolder)

…in getView(….)

UI tips Smooth scrolling ListView

RecyclerView

RecyclerView.ViewHolder

RecyclerView.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 viewer Systrace

Advance tips

Optimizing Battery Life

Read more at developer.android.com

Reducing Network Battery Drain Optimizing for Doze and App Standby

Monitoring the Battery Level and Charging State Manipulating Broadcast Receivers On Demand

giaplee

giap.lee.68@gmail.com

Linkedin.com/in/giaplee

Contact me: