Most Android apps need to save data, even if only to save information about the app state during onPause() so the user’s progress is not lost. Most non-trivial apps also need to save user settings, and some apps must manage large amounts of information in files and databases.
If you have a relatively small collection of key-values that you’d like to save, you should use the
SharedPreferences APIs. A
SharedPreferences object points to a file containing key-value pairs and provides simple methods to read and write them.