when is onRestoreInstanceState called?

后端 未结 6 847
有刺的猬
有刺的猬 2020-12-01 08:49

Sorry for my incomprehension, but I am new in the android development.

I have an application with activity A and activity B in it, and I go from activity A to activi

6条回答
  •  伪装坚强ぢ
    2020-12-01 09:44

    reference

    onSaveInstanceState

    ... onPause()-> onSaveInstanceState() -> onStop() -> onDestory()
    

    onRestoreInstanceState

    onCreate()-> onStart()-> onRestoreInstanceState()-> onPostCreate(Bundle) ...
    

    Or You can use LiveData. Save the states in it and observe.If the device rotates it'll update the views accordingly.

提交回复
热议问题