开发者

How to create sqlite database at the time of android app installation?

开发者 https://www.devze.com 2023-03-09 21:50 出处:网络
I am having Registration screen as my first screen but before that i want to create databas开发者_如何学JAVAe. is it possible to create database at time of installation in android rather than creating

I am having Registration screen as my first screen but before that i want to create databas开发者_如何学JAVAe. is it possible to create database at time of installation in android rather than creating in first activity.


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

  1. Create the sqlite db using SQLite Database Browser and store it in your assests folder
  2. When app launches, copy the db from assets to your apps data directory
  3. Open the DB

This way you don't have to parse csv files or dynamically create the db on the device, saving time during first load.


If you want to use a previously created database in your application,at the time of installation the you need to create a database put it in assets folder and then copy it in application. refer this links: SQLite Database "context" passed to adapter

Database not copying from assets

adding your own SQLite database to an android application

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号