@TryLoveCatch
2022-05-12T09:31:10.000000Z
字数 2368
阅读 530
Android知识体系
1.Activity1启动:
Activity1: onCreate()
Activity1: onStart()
Activity1: onResume()
2.点击按钮跳转到Activity2:
Activity1: onPause()
Activity2: onCreate()
Activity2: onStart()
Activity2: onResume()
Activity1: onStop()
3.从Activity2中返回:
Activity2: onPause()
Activity1: onRestart()
Activity1: onStart()
Activity1: onResume()
Activity2: onStop()
Activity2: onDestroy()
4.Activity1退出
Activity1: onPause()
Activity1: onStop()
Activity1: onDestroy()
1.Activity1启动:
Activity1: onCreate()
Activity1: onStart()
Activity1: onResume()
2.点击按钮跳转到Activity2:
Activity1: onPause()
Activity2: onCreate()
Activity2: onStart()
Activity2: onResume()
3.从Activity2中返回:
Activity2: onPause()
Activity1: onResume()
Activity2: onStop()
Activity2: onDestroy()
4.Activity1退出
Activity1: onPause()
Activity1: onStop()
Activity1: onDestroy()
1.Activity1启动:
Activity1: onCreate()
Activity1: onStart()
Activity1: onResume()
2.点击按钮弹出系统对话框
没有任何生命周期变化
https://www.csdn.net/tags/MtTaIgxsMDEzMTk3LWJsb2cO0O0O.html
左图显示使用 startService() 创建的服务的生命周期
右图显示使用 bindService() 创建的服务的生命周期。
注意:Service可以同时以这两种方式运行,也就是说,调用startService()方法启动Service的同时可以调用bindService()方法绑定Service。这种情况下,只有当所有客户端都解除绑定,并且有组件调用stopService()方法或者Service调用stopSelf()方法才可以停止Service。
startService()和bindService()方法的差异
https://developer.android.google.cn/guide/components/activities/activity-lifecycle
https://blog.csdn.net/GracefulGuigui/article/details/115817190
https://developer.android.google.cn/guide/components/services
https://www.jb51.net/article/222191.htm
https://zhuanlan.zhihu.com/p/152199572