Issue
I am developing a application where I am creating few tables in sqlite database but my requirement is table needs to be altered (few columns can be deleted or added), First time when application runs it creates tables with columns but when I add few columns and run again then these columns are not getting added.
I doubt since database is already created so control is not going to oncreate
in database class.
My issue is I need to delete the already created database in genymotion but no idea how to delete.
can any one explain how to delete it when using genymotion emulator.
Thanks Siva
Solution
Once you change the database scheme, you need to increment the version in your SQLiteOpenHelper implementation. Doing that, next time you app launches you can handle the database change in the
onUpgrade(SQLiteDatabase db,int old Version,int newVerison)
There you can do anything you like..alter table, drop table etc..
or.. you can simply uninstall you app. It will delete the database.
There is a good tutorial on this here: http://www.vogella.com/tutorials/AndroidSQLite/article.html
ps: sorry it was upgrade not update.
Answered By - paulovap
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.