理解Fragment的声明周期(转载)
来源:互联网 发布:淘宝网登陆不了怎么办 编辑:程序博客网 时间:2024/05/17 00:02
官网帮助文档链接:
http://developer.Android.com/guide/components/fragments.html
主要看两张图,和跑代码
一,Fragment的生命周
二,与Activity生命周期的对比
场景演示 : 切换到该Fragment
11-29 14:26:35.095: D/AppListFragment(7649): onAttach
11-29 14:26:35.095: D/AppListFragment(7649): onCreate
11-29 14:26:35.095: D/AppListFragment(7649): onCreateView
11-29 14:26:35.100: D/AppListFragment(7649): onActivityCreated
11-29 14:26:35.120: D/AppListFragment(7649): onStart
11-29 14:26:35.120: D/AppListFragment(7649): onResume
屏幕灭掉:
11-29 14:27:35.185: D/AppListFragment(7649): onPause
11-29 14:27:35.205: D/AppListFragment(7649): onSaveInstanceState
11-29 14:27:35.205: D/AppListFragment(7649): onStop
屏幕解锁
11-29 14:33:13.240: D/AppListFragment(7649): onStart
11-29 14:33:13.275: D/AppListFragment(7649): onResume
切换到其他Fragment:
11-29 14:33:33.655: D/AppListFragment(7649): onPause
11-29 14:33:33.655: D/AppListFragment(7649): onStop
11-29 14:33:33.660: D/AppListFragment(7649): onDestroyView
切换回本身的Fragment:
11-29 14:33:55.820: D/AppListFragment(7649): onCreateView
11-29 14:33:55.825: D/AppListFragment(7649): onActivityCreated
11-29 14:33:55.825: D/AppListFragment(7649): onStart
11-29 14:33:55.825: D/AppListFragment(7649): onResume
回到桌面
11-29 14:34:26.590: D/AppListFragment(7649): onPause
11-29 14:34:26.880: D/AppListFragment(7649): onSaveInstanceState
11-29 14:34:26.880: D/AppListFragment(7649): onStop
回到应用
11-29 14:36:51.940: D/AppListFragment(7649): onStart
11-29 14:36:51.940: D/AppListFragment(7649): onResume
退出应用
11-29 14:37:03.020: D/AppListFragment(7649): onPause
11-29 14:37:03.155: D/AppListFragment(7649): onStop
11-29 14:37:03.155: D/AppListFragment(7649): onDestroyView
11-29 14:37:03.165: D/AppListFragment(7649): onDestroy
11-29 14:37:03.165: D/AppListFragment(7649): onDetach
比Activity多了一些生命周期,完整和Activity对接上,大家好好利用。
转自http://blog.csdn.net/forever_crying/article/details/8238863/
有好多大神帮我们整理了很多资料,如果没有他们,我们可能自己需要很长时间去摸索,感谢他们!
- 理解Fragment的声明周期(转载)
- Fragment的声明周期整理
- fragment的声明周期,事务
- Fragment声明周期 开发遇到的问题
- Activity的声明周期
- Bean的声明周期
- 对象的声明周期
- activity的声明周期
- activity 的声明周期
- ViewController的声明周期
- ViewController 的声明周期
- activity的声明周期
- unity的声明周期
- TagSupport类的声明周期
- 类的声明周期 一
- JAVA--类的声明周期
- 远程对象的声明周期
- 管理Bean的声明周期
- Java:栈(Stack)和队列(Queue)的使用
- 微信开放平台开发——网页微信扫码登录(OAuth2.0)
- 孩子4岁可以开始学习武术,长练习可以减少生病!
- CodingNet - Learning - 7
- Android源码中的目录结构详解
- 理解Fragment的声明周期(转载)
- Devexpress GridViewControl 整理
- details——内容可伸缩的标签
- 第十一周项目一 点 圆 圆柱类族的设计
- 播放器几种控件
- CPU负载的分析
- 15个易遗忘的java知识点
- center os 安装mysql5.6
- c#中sqlserver数据库事务处理