[Android] Activity 和 SurfaceView 的生命周期

0_12803210018q71-1

1、程序打开
Activity 调用顺序:onCreate()->onStart()->onResume()
SurfaceView 调用顺序: surfaceCreated()->surfaceChanged()

2、程序关闭(按 BACK 键)
Activity 调用顺序:onPause()->onStop()->onDestory()
SurfaceView 调用顺序: surfaceDestroyed()

3、程序切到后台(按 HOME 键)
Activity 调用顺序:onPause()->onStop()
SurfaceView 调用顺序: surfaceDestroyed()

4、程序切到前台
Activity 调用顺序: onRestart()->onStart()->onResume()
SurfaceView 调用顺序: surfaceChanged()->surfaceCreated()

5、屏幕锁定(挂断键或锁定屏幕)
Activity 调用顺序: onPause()
SurfaceView 什么方法都不调用

6、屏幕解锁
Activity 调用顺序: onResume()
SurfaceView 什么方法都不调用

About skylook

增强现实、图像识别技术爱好者。
This entry was posted in Android开发. Bookmark the permalink.

发表评论

电子邮件地址不会被公开。




Optimization WordPress Plugins & Solutions by W3 EDGE