Skip to main content

Posts

Showing posts from November, 2012

How to Utilize the onUpgrade method in your SqliteOpenHelper Class in Android

Based on this website's blogpost on how to non-destructively upgrade your Android app's database , I've encountered a scenario such as this: 1. I have a database which has a database version 1 which has an existing table being constructed in user's phones. 2. If I were to have a new column in my database table, if I were to deploy the new version of the app into the Google Play Store (what I mean here is an incremental install), of course I would have users bitching about force closes in my app because the database is altered, for instance by adding another column in my database table. The blogpost is helpful as he highlighted how database table alteration can be done by incrementing the database version and onUpgrade method is triggered in your SqliteOpenHelper class.