onSaveInstanceState () and onRestoreInstanceState ()

前端 未结 13 2208
孤城傲影
孤城傲影 2020-11-22 04:48

I\'m trying to save and restore the state of an Activity using the methods onSaveInstanceState() and onRestoreInstanceState().

13条回答
  •  遥遥无期
    2020-11-22 05:54

    It is not necessary that onRestoreInstanceState will always be called after onSaveInstanceState.

    Note that : onRestoreInstanceState will always be called, when activity is rotated (when orientation is not handled) or open your activity and then open other apps so that your activity instance is cleared from memory by OS.

提交回复
热议问题