在Android的设备数据库更新 [英] Android Database Update on Device

查看:162
本文介绍了在Android的设备数据库更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更新安装的应用程序的数据库。首先,我不能将数据库文件路径;没有名为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

<一个href=\"http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html#onUpgrade%28android.database.sqlite.SQLiteDatabase,%20int,%20int%29\" rel=\"nofollow\">http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html#onUpgrade%28android.database.sqlite.SQLiteDatabase,%20int,%20int%29

这篇关于在Android的设备数据库更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆