Previous articlesArticleThis section describes three primary methods for storing data in Android applications: sharedpreferences, internal storage, and external SD card storage. What is the method used in your application? The following are some suggestions:
1. If you have data in the form of key-value pairs, use the sharedpreferences object. For example, if you want to store some attributes of a user, such as name, skin color, birthday, or last login date, the sharedpreferences object is the best way to store the data.
2. If you want to store some special data, using internal storage is a good choice. For example, your application (such as an RSS reader) may download some images from the Internet for display. In this case, it is a good solution to save images to internal storage. It is also possible that you want to store the data created by the user, such as the user's own notes.
3. Sometimes, you need to share your application data with other users. For example, you may develop a software that records the coordinates of the places where the user has been, and shares the data with other users. In this case, save your file to the SD card, so that you can easily transfer the data to other devices for future use.