的CheckBox不是住在离开活动并返回后检查 [英] CheckBoxes not staying checked after leaving the activity and returning to it
问题描述
我组建了一个非常基本的Android应用中,用户定义了使用的CheckBox一些preferences。我有一套因此,我想留下来选中或取消选中(取决于用户与他们如何互动),如果用户移动到previous活动,或为此事即使用户关闭应用程序,然后复选框重新打开它。我不知道如何去这样做,任何帮助吗?我会想象有一定的方法来使用保存的复选框的状态,但我不知道他们会或如何使用它们。
I am putting together a very basic Android app in which the user defines some preferences using CheckBoxes. I have a set of CheckBoxes which I therefore want to stay checked or unchecked (depending on how the user interacts with them) if the user moves to a previous activity, or for that matter even if the user closes the app and then reopens it. I'm not sure how to go about doing this, any help? I would imagine there are certain methods to use to save the state of the CheckBoxes, but I am not sure what they would be or how to use them.
推荐答案
您有几种选择(从易到最难)
You have several options (from easiest to the hardest)
- 使用共享preferences
- 将设置保存到文件系统作为.xml文件
- 将设置保存到本地SQLite数据库
这篇关于的CheckBox不是住在离开活动并返回后检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!