Android Database Update on Device

拈花ヽ惹草 提交于 2019-12-08 09:39:42

问题


I want to update the database of installed application. First of all, I couldn't the database file path; there is no file called mypackage in /data/data/ . How can I find the database file path?

Secondly, I want to delete the old file and replace it my new database. How can I manage this?


回答1:


say you make a program with the packagename of com.example.program, your path will be

/data/data.com.example.program/databasefile

bur for updating it, put your code in onUpdate and change the version number

http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html#onUpgrade%28android.database.sqlite.SQLiteDatabase,%20int,%20int%29



来源:https://stackoverflow.com/questions/8583994/android-database-update-on-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!