Suppose an application stores some user related or users favorite records in its local database. When I upgrade my application, what happens to the db? As an developer, how do I prevent loss of data?开发者_如何学Go
You can see how to do this in the developer docs at http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html
If your database schema does not change then you'll be fine as the data is kept during an upgrade. If you change your database schema you should use onUpgrade to bring a previous version of the database up to the latest version.
精彩评论