Question

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

Was it helpful?

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.

OTHER TIPS

Just uninstall your app from emulator and run it again. Uninstalling an app will removes all related files and databases.

I find all these answers cumbersome. Put the File Manager in Root Permission, find the sqlite db file and deleted it. Seems the easiest route for me...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top