Updating Android app properly?
Help! I updated my android application on the market. This update included a change in the databaseHelper file where I put in more data and tables. Normally, when debugging, I would have to uninstall and reinstall the app because it doesn't see the new values in the database. Now, it's doing the same thing on the market.
开发者_高级运维Why is this happening? How can I fix this? Is it possible to 'rollback' the changes to the app?
You can't roll it back - there is no history in the market. You can publish your previous version again (which, of course, will cause database mayhem again).
As for upgrading databases - You should be using SQLiteOpenHelper
to manage your database. That way, you can have a version number, which will be used to call onUpgrade() when necessary at which point you can use ALTER TABLE
to add new columns (or create new tables altogether). The notepad example demonstrates all this.
精彩评论