Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the most important optimizations in Java code on Android?

Tags:

java

android


I am just starting out programming on Android.

What is the most computationally expensive Java constructs to avoid when programming an Android App?

Of cause every algorithm costs instructions, but what about use of Method calls, Object references, Interfaces, Collections and such? What do I need to avoid, and what is "cheap" when I'm programming for speed?

like image 735
Svante Avatar asked Jun 19 '26 03:06

Svante


1 Answers

You can find official guidelines here: http://developer.android.com/guide/practices/design/performance.html

You should also read http://developer.android.com/guide/practices/design/responsiveness.html and http://developer.android.com/guide/practices/design/seamlessness.html

There are some specific GUI optimizations (like ViewHolder pattern for ListAdapters) but start writing your app first, then fix things which are too slow. And remember: do not guess, use included profiler (tool TraceView and Debug class) to find out what exactly needs to be improved.

like image 90
tomash Avatar answered Jun 20 '26 17:06

tomash