安卓actionBar tab+fragment生命周期流程

对fragment和tab的流程不太清楚 以至于MainActivity中的frag实例化后,再多线程调用时内部变量总是为null,记录下生命周期流程  备忘 其中FragmentVideoCall继承自fragment

MainActivity->onCreate    

  
 
actionbar和TabListener在此 add

TabListener->onTabSelected  

fragment在此实例化 

FragmentVideoCall->onCreateView
FragmentVideoCall->onActivityCreated

FragmentVideoCall->onStart

此三步中初始化frag中各种变量

MainActivity->onResume  

frag在此从TabListener中获取实例

猜你喜欢

转载自blog.csdn.net/jinyulong84/article/details/80769576