Android provides contentprovider. A program can completely expose its data by implementing an abstract interface of contentprovider, and contentproviders exposes data in a way similar to a table in a database, that is to say, contentprovider is like a "Database ". The data provided by the outside world should be basically the same as the data obtained from the database, except that the URI is used to indicate the "Database" that the outside world needs to access ". As for how to identify which database is needed from the URI, this is what the android underlying layer needs to do. In brief, contentprovider provides external data operation interfaces:
Query (Uri, string [], String, string [], string)
Insert (Uri, contentvalues)
Update (Uri, contentvalues, String, string [])
Delete (Uri, String, string [])
These operations are basically the same as database operations. For details about the parsing, refer to the detailed description in Android SQLite parsing. Uri:
The D part of URI may contain a _ id, which should appear in the SQL statement and can appear in a special way. This requires that when we provide data, you need to pay attention to this special information. The recommended method for Android SDK is to include an ID in the provided data table field. During table creation, integer primary key autoincrement identifies this ID field.