Four ways to store Android data
As a finished application, data storage operations are essential. As a result, the Android system offers four ways to store data.
are: Sharepreference, SQLite, Content provider, and file.
Because the data is basically private in the Android system, it is stored in the "data/data/package name" directory, so to achieve data sharing, the correct way is to use content Provider.
Sqlite:sqlite is a lightweight database that supports basic SQL syntax and is often used as a way of storing data.
Android provides a class named Sqlitedatabase for this database, encapsulating some of the APIs that manipulate the database. is limited to the current program.
Sharedpreference: In addition to the SQLite database, another common method of data storage, which is essentially an XML file, is often used to store simpler parameter settings. is limited to the current program.
File: The commonly used method of storing files (I/O), often storing large amounts of data, but the drawback is that updating the data will be a difficult task.
A data storage method that enables all applications to be shared in a contentprovider:android system, since data is usually private to each application,
Therefore, this storage method is less used, but it is an essential storage method. For example, audio, video, pictures, and contacts can generally be stored in this way.
Each content provider will provide a public URI (wrapped as a URI object), and if the application has data to be shared,
You need to use content provider to define a URI for the data, and then other applications to manipulate the data by passing in the URI with the content provider.
Four ways of storing Android data