#Some notes:
###optimization
-
Use hardware to accelerate app. add
android:hardwareAccelerated=”true”
after appliation tag. It's activated by default after version Android 4.0. -
Set View cacheable.
setDrawingCache = "true"
-
<merge>
avoid over-drawing layout,<include>
shared layout. -
Use files when you could do it. It's 10 times faster then doing SQL operation.
-
if no local member is invoked in a method, make it
static
, it will up performance by 15~20%. -
Check memory limit per app.
` ActivityManager manager = (ActivityManager)this.getSystemService(Context.ACTIVITY_SERVICE);` `Log.d("Memory", manager.getMemoryClass() + "");`
-
Why Viewholder?
ListView or RecyclerView could only call findbyId() limited times and then reuse the elements when list scrolled up or down.
Tip: declare Viewholder with key word
static
, and it will reduce the amount ofthis
calls fromMainActivity
, and then reduce the amount ofMainActivity
reference calls.