How to create sqlite database during installation of android application?

I have a registration screen as my first screen, but before that I want to create a database. Is it possible to create a database at the time of installation in android, and not create in the first activity.

+4
source share
2 answers

This is a great article that helps http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

  • Create sqlite db using SQLite Database Browser and save it in the folder with your data.
  • When the application starts, copy the db from the assets to the data directory of your applications.
  • Open db

Thus, you do not need to analyze csv files or dynamically create db on the device, saving time during the first boot.

+12
source

If you want to use the previously created database in your application, during installation you need to create the database by placing it in the resource folder and then copying it to the application. References: SQLite Database "context" passed to adapter

Database is not copied from assets

adding native SQLite database to Android app

0
source

All Articles