
Android:性能优化
丁大黄
Android开发
展开
-
【Android】其他优化
1、Method Profiling工具 https://developer.android.com/studio/profile/android-profiler?hl=zh-cn 这个工具可以将每个方法耗用时间汇总图呈现出来。 可以找到最耗时的方法。 2、Lint工具 https://developer.android.com/studio/write/lint?hl=zh-cn 3、特殊容器 装箱和拆箱 基本类型——包装类型 Integer 16个字节, int 4个字节。 谨防自动拆箱和自动拆箱原创 2020-11-14 13:08:36 · 109 阅读 · 0 评论 -
【Android】Bitmap优化
Bitmap decode 常见的图像存储格式:jpg,png,webp Android中显示图片必须要先经过解码(decode)读取图像的数据到内存中 BitmapFactory提供了常用的一些decode方法 图片真正占用的内存大小要看decode之后的数据大小。用字节数组的方式存储。 Bitmap memory <= 2.3.3(api 10) Bitmap解码之后的数据存储在NativeMemory中,手动调用Recycle回收 =3.0 (api 11) Bitmap解码之后的数据原创 2020-11-12 21:58:25 · 391 阅读 · 0 评论 -
【Android】性能优化
1 内存优化 1.1 垃圾回收 1.2 内存监控 方法一: Android Studio 3.0 及更高版本中的 Android Profiler 取代了 Android Monitor 工具。 方法二: 使用LeakCanary查看应用中谁在泄漏内存: https://github.com/square/leakcanary https://square.github.io/leakcanary/getting_started/ 使用简单到令人发指:只要添加如下依赖即可!! dependencies {原创 2020-11-12 10:01:51 · 182 阅读 · 0 评论