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
• 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-build app with Contacts & Sign-In
- Android in-app billing: 关于 RESTORE_TRANSACTIONS
- integrate opencv manager in an android app
- SIGPIPE received in android system native app on Jellybean
- 2 solutions for google map app in android
- Android实现in_app purchase: The item you were attempting to purchase could not be found
- How To Use Proguard in Android APP
- PXF webapp is inaccessible but tomcat is up
- How to: subversion build number in your Android app
- Android APP打包时,出错:"XXX" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic).....
- 艾玛迪斯咨询讨论Android应用程序开发的In App Purchase
- Android NDK: WARNING: APP_PLATFORM android-8 is larger than android:minSdkVersion,in ./AndroidMan
- How To Use Proguard in Android APP
- How to Use FontAwesome in an Android App(把 icons 变得和 text 一样)
- Error:(22, 13) Failed to resolve: com.android.support:appcompat-v7:14.+ <a href="install.m2.repo">In
- Android 项目打包时报错:"app_name" is not translated in af