______________________ Excerpt from: http://www.cnblogs.com/yezhennan/p/5442557.html____________________
1. Handling of large pictures
Bitmap bmp = Bitmapfactory.decodefile (Sourcebitmap, Options);
2. Remember to recycle the memory after you have finished using the picture
!bitmap.isrecycled ()--->bitmap.recycle (); bitmap = null;
3. Picture Cache LruCache
4. Thread Pool Excutors
/**thread pool that executes only one task at a time*/Executorservice Singletaskexecutor=Executors.newsinglethreadexecutor (); /**each time a thread pool is executed with a limited number of tasks*/Executorservice Limitedtaskexecutor= Executors.newfixedthreadpool (3); /**thread pool where all tasks are started at once*/Executorservice Alltaskexecutor=Executors.newcachedthreadpool (); /**Create a thread pool that can perform tasks at a specified time, or execute repeatedly*/Executorservice Scheduledtaskexecutor= Executors.newscheduledthreadpool (3);
5.convertView of cache processing
6.CUROSR I/O registration broadcast Bindservice Registration Some listeners remember to log off.
--------------------------------------------------------------------------------------------------------------- -----------------------------------
Other tips:
1. The resolution adapts-ldpi,-mdpi,-HDPI configures the different precision resources, the system will adapt according to the equipment, including drawable, Layout,style and so on different resources.
2. use DP (density independent pixel) to develop without PX (pixel).
3. Multi-use wrap_content, match_parent
4. Never use Absolutelayout
5. using 9patch (Launch application via ~/tools/draw9patch.bat), PNG format
6. set the background image of window in acitivity to empty. GetWindow (). setbackgrounddrawable (null); The default background for Android is not empty.
7.Set cache properties in view. Setdrawingcache is true.
Desgin Review (Design check):
Desgin review mainly focus on checking the design of the program is reasonable, including the design of the framework, interface design, logical design (actually these things should be thought well before development).
Frame design:
Do you define a base class of common controls such as activity and fragment to avoid duplication of effort
Whether there is a perfect exception handling mechanism, even if the real oom will not directly collapse resulting in the direct exit program
Interface design:
1. Load what you need in the view, not what you have. Because users can't see everything at the same time. The most typical example is a sliding load in a ListView.
2. If the data is particularly large, this should imply that the user clicks on the load instead of loading it directly.
3. reasonable use of split screen, turn screen, and so on, it is a double-edged sword, because it can make the program more beautiful function more perfect, but also the corresponding increase in resource costs.
Logic design:
Avoid subclasses directly to control the contents of the parent class, you can use monitoring and other ways to solve
Android: Some summary of memory optimizations