database - does Android application come with sqlite databse created when an application is released? -


i working on android application. have 2 related questions sqlite database in android.

1) have got bunch of sql queries create database tables in sqliteopenhelper class. queries executed in oncreate(sqlitedatabase db) method. database , database tables re-created each time run application, using cellphone? or should else create database , tables @ once if don't exist?

2) when release application, playstore, remove sql queries , include created database file in application folder users can download database along application? or should leave sql queries create database , tables users download application , when run it, queries executed , create database?

sorry guys asking 2 questions @ time, believe quite related.

thanks!

1)once have changed database structure adding columns or modify existing table,

you should increase database version number. changes applied.

 public void onupgrade(sqlitedatabase db, int oldversion, int newversion) 

for more info refer link. https://developer.android.com/training/basics/data-storage/databases.html

2) can't remove sql queries , include created database file in application. because table created when user runs application. , created once calling database initialization method. database updated if increase database version number.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -