原料资源的Andr​​oid文件路径路径、原料、文件、资源

2023-09-07 09:26:12 作者:原来我还是错过了你

我有数据库放在原始的文件夹,我需要加载数据库路径安装APK是什么时候?在哪儿?在/数据/数据​​/程序包/文件?我没有看到呢?

I have database placed in raw folder and i need to load the database path when the apk is installed? Where it is? in /data/data/package_name/FILE ? I dont see it?

我的工作与extisting SQLite数据库。

I work with extisting sqlite database.

推荐答案

它没有路径:这是一种资源,所以你需要的是这样使用 getResources()来引用

It has no path: It is a resource, so you need to reference is as such using getResources().

您应该在第一次运行时,将其复制到 /data/data/YOUR_APP_FOLDER/databases/YOUR_DB.db

You should, at the first run, copy it to the /data/data/YOUR_APP_FOLDER/databases/YOUR_DB.db

您可以按照本教程:的http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/