您的位置:首页 > 移动开发

speeding up app in android

2012-06-19 15:29 225 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: