I have to give a dialog when my activity is launched at first time.
So I do that in my
public void onCreate(Bundle savedInstanceState)
and use
protected void onSaveInstanceState (Bundle outState)
to save the time of my launch. I notice that OS create a new “Bundle outState” instead of using the old one. And I can not debug the the date when re Oncreate.
My question:
-
The date I saved in onSaveInstanceState , could be really read by Oncreate? And how to debug?
-
Could I just use a private member vary to save the state and without being deleted by OS when the process is killed by OS.
Thank you for your help.
Bundlecannot be used to carry the data across application restarts.You’d better save your data to the more permanent storage, like
SharedPreferences, put this code inonCreate():