By default upload some data to our sqlite database

I want to put some default tables in our sqllitedb.

I want to display different elements according to different categories. In the application, the user can also add elements and new categories, for this purpose I want to add some data to db by default. How to add sqlitedefault data . Please give me some advice.

Thanks in advance

+3
source share
2 answers

You can pre-pack the database by creating the database using the SQLite database editor , and then put the pre-created database in your folder with resources that you can get from your application.

+4
source

Suppose you use SQLiteOpenHelper, as in the Notepad tutorial.

SQLiteOpenHelper onCreate()the method is called if the database has not yet been created. This is the place where the initial filling of the tables should take place.

+1
source

Source: https://habr.com/ru/post/1772668/


All Articles