- instantaneous data : Refers to data that is stored in memory that may be lost due to program broadcasts or other causes of memory being recycled.
- data Persistence : means that the instantaneous data in memory is saved to the storage device, ensuring that the data is not lost even when the phone or computer shuts down.
The data stored in memory is instantaneous, and the data stored in the device is persistent, and the persistence technology provides a mechanism for the data to switch between the transient state and the persistent state. The Android system offers three ways to simply implement data persistence:
- file Storage : Is the most basic form of data storage in Android. no formatting is done on the stored content, and all data is saved intact to the file . Therefore, this approach is more appropriate than storing some text data or binary data . If you want to use file storage to save more complex text data, you need to define a set of formatting specifications, which makes it easy to re-parse the data from the file.
- sharedpreference Storage :
- Database Storage :
In addition, we can also store data in an SD card . However, using these three methods is simpler and more secure.
Android Basics Summary (5)--data storage, persistence technology