First, SQLite
1. Basic Operation:
(1) Create a database: Created in the subclass constructor of Sqliteopenhelper.
(2) CREATE TABLE: In the subclass OnCreate method of Sqliteopenhelper, call the Execsql method implementation.
(3) Add, delete, change, check: Call Sqlitedatabase's INSERT, delete, update, query method, or use SQL statements in the Execsql method to achieve the corresponding function.
2. Operate the database with transactions
(1) Start the transaction db.begintransaction () and then perform the operation
(2) The operation is complete then db.settransactionsuccessful ()
(3) Last Db.endtransaction ()
Second, ContentProvider
(1) The role of ContentProvider is to provide application data to other applications.
(2) How to use: First through the Getcontentresolver () method, get the instance object of Contentresolver, and then use the Uri.parse (what data you want to access) to create the URI object, and finally you can use these two objects to operate.
(3) Implementation mode: First create a urilist class to hold the shared URI, and then create the ContentProvider subclass, create Urimatcher in it, add the URI, and then you can implement some of the operations inside the method.
Simple learning experience: NetEase Cloud Classroom Android Development sixth chapter SQLite and ContentProvider