What's the correct way to save state of an Activity
I have an Activity, which contains a bunch of check boxes and a submit button.
When the submit button is clicked, the activity will exit (finish() will be called). Before the activity exits, I want to save the states of the check boxes in the activity, so when the activity starts again, the check b开发者_开发百科oxes can stay in their previous states. What's the correct way to save these states? Should I use SharedPreference.
Thanks.
Yes, I believe SharedPreference is the best option.
You can check for more information at android page.
Hope that helps.
精彩评论