开发者

raw Resources Android filepath

开发者 https://www.devze.com 2023-03-10 12:21 出处:网络
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?

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?

I work with extisting sqlite database.


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

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

You can follow this tutorial: http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/


The files in the raw folder are packed in the application's APK file. To open one of these files, use getResources().openRawResource(int id).

0

精彩评论

暂无评论...
验证码 换一张
取 消