简体   繁体   中英

Beginner Android: Files and Checkboxes

I am a beginner so please bear with me. I am making an app that presents the user with a list of achievements and has the user select the check box if they have completed it. I want to be able to save the user's choice for the next time they open the app. I have seen this accomplished with other apps but I am unsure of how to accomplish this. I did research investigating writing int and array values to files. Most of these answers said that it could only be done with string values. Any suggestions?

Thanks, Drew

What you need to use is the Shared Preferences

Android also has a special activity called called PreferenceActivity which makes building preferences screen much easier.

Save the choices to a preferences file.

Android Preferences

You can override onSaveInstanceState function for saving current state, almost of values would be saved in string format. The string value can be loaded and convert from string to other types.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM