app启动流程:冷启动,热启动,暖启动

前言:项目中被诟病多媒体开机第一次启动很慢,大约3s的黑屏,后续点开启动正常,其中什么原理呢?这就涉及到系统的三种启动模型

1.Cold Start,冷启动

system--->
loding and launching the app
displaying a blank window
createing the app process


process--->
creating the application
launching the main thread
creating the main activity
inflating views
laying out the screen
perfoming the initial draw
main activity place blank window


2.Hot Start,热启动

前台activity因内存不足,被系统销毁重建的过程(重建流程同冷启动)

3.Warm Start

  • 用户点击返回,并重新运行
  • activity不在前台,被系统销毁,由用户主动运行
    可通过onSaveInstance保存状态

4.APP启动慢常见问题

  • Application.onCreate中执行了过重的操作,如I/O操作,频繁创建对象等
  • Activity.onCreate
    布局过于复杂
    Loading and decoding bitmaps
    blocking screen drawing on disk or network I/O
    Rasterinzing vectordrawable objects
    initialztion of other subsystem of the activity
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值