理解Fragment生命周期
来源:互联网 发布:java写爬虫 编辑:程序博客网 时间:2024/06/01 19:31
官网帮助文档链接:
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对接上,大家好好利用。
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- Fragment生命周期理解
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- 理解Fragment生命周期
- java多线程(三)-同步工具Semaphore
- 自定义滑动开关
- Android 实现ListView的A-Z字母排序和过滤搜索功能,实现汉字转成拼音
- TCP/IP、Http、Socket的区别
- ngix
- 理解Fragment生命周期
- jquery AJAX提交乱码的处理
- 无限循环小数和无限不循环小数
- SecureCRT的rz 和gz不能使用
- LeetCode Ugly Number
- nginx built-in variables (nginx 内置的变量)
- json数据处理相关
- Markdown编辑器使用说明
- OpenBlas库----cblas_dgemm()函数