Question about onUpgrade method android

后端 未结 2 1521
無奈伤痛
無奈伤痛 2021-01-26 10:49

I have an application published in the android market, and now I want to make a new version with changes in the database. The problem is, my version of the app that is already p

相关标签:
2条回答
  • 2021-01-26 11:25

    So what onUpgrade method will be called, from the old or from the new .apk.

    From new .apk. Old one is gone at this point.

    Can I keep the data from the tables?

    You have to code your upgrade in such a way that you retain data that you need including old data as required.

    0 讨论(0)
  • 2021-01-26 11:25

    Dropping the tables will kill all of your current data. In order to preserve the data, you're going to need to write a custom onUpgrade method to do this. Here's a previous post that discusses this and may give you some ideas on what you need to do:

    SQLiteOpenHelper onUpgrade() Confusion Android

    0 讨论(0)
提交回复
热议问题