執(zhí)行順序
1.onCreate->2.onStart->3.onResume->Activity處于前臺(tái)
1.可做初始化后
2.當(dāng)前Activity可見(jiàn)
3.當(dāng)前Actviity已經(jīng)處于前臺(tái)
當(dāng)AActivity->BActivity跳轉(zhuǎn)時(shí) 執(zhí)行的生命周期
A.onPause->B.onCreate->B.onStart->B.onResume->A.onStop
為什么A.onStop最后執(zhí)行:這是Activty啟動(dòng)的一種非常好的策略 因?yàn)槿绻脩?hù)跳轉(zhuǎn)B后很快的返回到A那么 A將直接進(jìn)行 A.onResume即可恢復(fù)到前臺(tái) 而不需要經(jīng)過(guò)onReStaret->onStart->onResume
當(dāng)BActivity返回到AActivity
B.onPause->B.onStop->B.onDestory->A.onRestart->A.onStart->A.onResume
當(dāng)AActivity點(diǎn)擊back鍵
A.onPause->A.onStop->A.onDestory
當(dāng)彈出Dialog時(shí)會(huì)執(zhí)行那個(gè)生命周期
不會(huì)執(zhí)行,因?yàn)镈ialog依附于Activity 所以不會(huì)執(zhí)行Activity的任何周期函數(shù)
當(dāng)AActivty點(diǎn)擊Home
A.onPause->A.Stop