Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

I am having Registration screen as my first screen but before that i want to create database. is it possible to create database at time of installation in android rather than creating in first activity.

like image 828
Sando Avatar asked Jun 01 '11 08:06

Sando


People also ask

Which package is required to use SQLite database in Android app development?

SQLiteOpenHelper class provides the functionality to use the SQLite database.

Is SQLite inbuilt in Android Studio?

Android App Development for Beginners SQLite is a opensource SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation.


1 Answers

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.

like image 151
GeekYouUp Avatar answered Oct 05 '22 23:10

GeekYouUp