编程知识 cdmana.com

Kotlin foundation from introduction to advanced series (Introduction) SQLite database storage

Kotlin Basic introduction to advanced series ( Introduction )SQLite Database storage

SQLite Database storage

-> Return to the general catalog <-

1、 Create database

SQLiteOpenHelper Is an abstract class , You can create your own help class to inherit it .SQLiteOpenHelper There are two abstract methods :onCreate() and onUpgrade()

SQLiteOpenHelper There are also two very important example methods :getReadableDatabase() and getWritableDatabase(), Both methods can open or create an existing database ( If the database already exists, open it directly , Otherwise, create a new database ), And return an object that can read and write to the database .

newly build MyDatabaseHelper Class inherits from SQLiteOpenHelper, Code :

版权声明
本文为[Bin sir]所创,转载请带上原文链接,感谢
https://cdmana.com/2022/134/202205141410436371.html

Scroll to Top