Android provides 5 ways to store data (1) using sharedpreferences to store data, which is a mechanism provided by Android to store simple configuration information in an XML format that stores data in the device. Can only be used within the same package and cannot be used between different packages. Sharedpreferences storage, which is a mechanism provided by Android to store some simple configuration information, such as the user name and password of the logged-in user. It uses the map data structure to store the information, stored as a key value, and can be read and written in a simple way. Storage directory/data/data/package name/shared_pref (2) file store data, file storage is a more common method, the method of reading/writing files in Android is exactly the same as the program that implements I/O in Java, The Openfileinput () and Openfileoutput () methods are provided to read the files on the device. Storage directory/data/data/package name/files (3) SQLite database stores data; SQLite is a standard database with Android, it supports SQL statements, it is a lightweight. Storage directory/data/data/package name/database (4) uses ContentProvider to store data, primarily for data exchange between applications, enabling other applications to save or read this content Various data types for provider. (5) Network storage data, upload (store) and download (obtain) The data we store in cyberspace through the storage space provided to us on the network. (Xml,json)
Five ways to store Android data