在Android的设备数据库更新数据库、设备、Android

由网友(薄荷糖、微凉)分享简介:我想更新安装的应用程序的数据库。首先,我不能将数据库文件路径;没有名为mypackage的/数据/数据​​/文件。我怎样才能找到数据库文件的路径?I want to update the database of installed application. First of all, I couldn't the d...

我想更新安装的应用程序的数据库。首先,我不能将数据库文件路径;没有名为mypackage的/数据/数据​​/文件。我怎样才能找到数据库文件的路径?

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?

推荐答案

说你做一个程序com.example.program的软件包名,您的路径将是

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

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

钻更新它,把你的code中的onUpdate和更改版本号

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

阅读全文

相关推荐

最新文章