Saving Activity State in the onPause

后端 未结 3 660
情话喂你
情话喂你 2020-12-15 07:01

I have a variable that I have successfully saved and restored using onSaveInstanceState

@Override
protected void onSaveInstanceState(Bundle outState) {
    s         


        
3条回答
  •  伪装坚强ぢ
    2020-12-15 07:36

    If you choose to save the Activity state to Shared Preferences, you can check out the GNStateManager component of the library I wrote to make it easy to store and retrieve the required fields of the activity marked my @GNState annotation. It is dead simple to use. Other singleton class object states can be saved too. See here for Setup and Usage information: https://github.com/noxiouswinter/gnlib_android/wiki/gnstatemanager

提交回复
热议问题