onSaveInstanceState () and onRestoreInstanceState ()

前端 未结 13 2209
孤城傲影
孤城傲影 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

    The main thing is that if you don't store in onSaveInstanceState() then onRestoreInstanceState() will not be called. This is the main difference between restoreInstanceState() and onCreate(). Make sure you really store something. Most likely this is your problem.

提交回复
热议问题