开发者

What happens to my existing application database when I upgrade it to new version in Android

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜