android - Upgrading database version of an already built database -
i have database stored in assets
folder built using sqlite manager. now, when add new records table of database, have uninstall , reinstall app. have upgrade database in right way without uninstalling app?
note:
my
oncreate()
,onupgrade()
empty because mentioned, database built.i call
super(context, db_name, null, 1);
in helper constructor, changing version not becauseonupgrade()
empty.
to allow upgrading, must implement onupgrade
, whatever necessary convert old version new version.
if have new database file in assets
folder, must replace old file. not possible sqliteopenhelper
because has active transaction while onupgrade
called, when not using automatic creation/versioning mechanism, there not reason use sqliteopenhelper
in first place.
Comments
Post a Comment