1.mNavController.navigate(R.id.xxxx)执行结果

//启动Fragment A
 BaseFragment--onAttach CallPatientAFragment{249d69f4}
 BaseFragment--onCreate CallPatientAFragment{249d69f4}
 BaseFragment--onCreateView CallPatientAFragment{249d69f4}
 BaseFragment--onViewCreated CallPatientAFragment{249d69f4} 
 BaseFragment--onActivityCreated CallPatientAFragment{249d69f4} 
 BaseFragment--onStart CallPatientAFragment{249d69f4} 
 BaseFragment--onResume CallPatientAFragment{249d69f4} 
 //启动Fragment B
 BaseFragment--onAttach CallPatientBFragment{15cad4d} 
 BaseFragment--onCreate CallPatientBFragment{15cad4d} 
 BaseFragment--onCreateView CallPatientBFragment{15cad4d} 
 BaseFragment--onViewCreated CallPatientBFragment{15cad4d} 
 BaseFragment--onActivityCreated CallPatientBFragment{15cad4d} 
 BaseFragment--onStart CallPatientBFragment{15cad4d} 
 BaseFragment--onResume CallPatientBFragment{15cad4d} 
 
 BaseFragment--onPause CallPatientAFragment{249d69f4} 
 BaseFragment--onStop CallPatientAFragment{249d69f4} 
 BaseFragment--onDestroyView CallPatientAFragment{249d69f4} 

2.先 mNavController.popBackStack() 再mNavController.navigate(R.id.fg_call_patient_doctor)

//启动Fragment A
 BaseFragment--onAttach CallPatientAFragment{1bef0172} 
 BaseFragment--onCreate CallPatientAFragment{1bef0172} 
 BaseFragment--onCreateView CallPatientAFragment{1bef0172} 
 BaseFragment--onViewCreated CallPatientAFragment{1bef0172} 
 BaseFragment--onActivityCreated CallPatientAFragment{1bef0172} 
 BaseFragment--onStart CallPatientAFragment{1bef0172} 
 BaseFragment--onResume CallPatientAFragment{1bef0172} 
 
  //启动Fragment B
 BaseFragment--onAttach CallPatientBFragment{cdeaca0} 
 BaseFragment--onCreate CallPatientBFragment{cdeaca0} 
 BaseFragment--onCreateView CallPatientBFragment{cdeaca0} 
 BaseFragment--onViewCreated CallPatientBFragment{cdeaca0} 
 BaseFragment--onActivityCreated CallPatientBFragment{cdeaca0} 
 BaseFragment--onStart CallPatientBFragment{cdeaca0} 
 BaseFragment--onResume CallPatientBFragment{cdeaca0} 
 
 BaseFragment--onPause CallPatientAFragment{1bef0172} 
 BaseFragment--onStop CallPatientAFragment{1bef0172} 
 BaseFragment--onDestroyView CallPatientAFragment{1bef0172} 
 BaseFragment--onDestroy CallPatientAFragment{1bef0172} 
 BaseFragment--onDetach CallPatientAFragment{1bef0172} 
Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐