1.onSaveInstanceState()方法在onPause()之后onStop()之前執(zhí)行,若執(zhí)行了finish()不會(huì)執(zhí)行,只執(zhí)行onPause不執(zhí)行onStop()也不會(huì)執(zhí)行。
2.onRestoreInstanceState()方法在onStart()之后onResume()之前執(zhí)行,若Activity沒(méi)有被銷(xiāo)毀或者銷(xiāo)毀前沒(méi)有執(zhí)行onSavaInstanceState()那么onRestoreInstanceState()方法也不會(huì)執(zhí)行。
注意:onSaveInstanceState()只適合用于保存一些臨時(shí)性的狀態(tài),而onPause()適合用于數(shù)據(jù)的持久化保存。