speeding up app in android

1. View.onDraw( ) method is a very performance-criticalpiece of code, so it’s best to do as little as possible there.

• If possible, avoid doing any object allocations in the method onDraw( ).
• Prefetch things such as color constants elsewhere (for example, in the view’s constructor).
• Create your Paint objects up front, and just use existing instances in onDraw( ).
• For values used multiple times, such as the width returned by getWidth( ), retrieve the value at the beginning of the method and then access it from your local copy.

2. // TODO Continue to sum up


你可能感兴趣的:(android,object,Access,UP,Constructor,Constants)