zoukankan      html  css  js  c++  java
  • Android开发

    1. Fragment的生命周期

    见下图

    2. 与Activity生命周期的对比

    见下图

    3. 代码场景演示实例

    切换到该Fragment:

    AppListFragment(7649): onAttach
    AppListFragment(7649): onCreate
    AppListFragment(7649): onCreateView
    AppListFragment(7649): onActivityCreated
    AppListFragment(7649): onStart
    AppListFragment(7649): onResume

    屏幕灭掉:

    AppListFragment(7649): onPause
    AppListFragment(7649): onSaveInstanceState
    AppListFragment(7649): onStop

    屏幕解锁

    AppListFragment(7649): onStart
    AppListFragment(7649): onResume

    切换到其他Fragment:
    AppListFragment(7649): onPause
    AppListFragment(7649): onStop
    AppListFragment(7649): onDestroyView

    切换回本身的Fragment:

    AppListFragment(7649): onCreateView
    AppListFragment(7649): onActivityCreated
    AppListFragment(7649): onStart
    AppListFragment(7649): onResume

    回到桌面

    AppListFragment(7649): onPause
    AppListFragment(7649): onSaveInstanceState
    AppListFragment(7649): onStop

    回到应用

    D/AppListFragment(7649): onStart
    AppListFragment(7649): onResume

    退出应用

    AppListFragment(7649): onPause
    AppListFragment(7649): onStop
    AppListFragment(7649): onDestroyView
    AppListFragment(7649): onDestroy
    AppListFragment(7649): onDetach

  • 相关阅读:
    题解 P3071 【[USACO13JAN]座位Seating】
    [luogu]P3398 仓鼠找sugar
    快速输入输出
    Luogu P3939 数颜色
    HEOI2016/TJOI2016 排序
    POI2011 DYN-Dynamite
    USACO17JAN Promotion Counting
    AHOI2008 聚会
    Luogu P4907 A换B problem
    网络流24题 骑士共存问题
  • 原文地址:https://www.cnblogs.com/davidgu/p/6002939.html
Copyright © 2011-2022 走看看