开发者

Android: Expose a pre-loaded DB with data files as ContentProvider

开发者 https://www.devze.com 2023-03-31 08:33 出处:网络
I have to bundle a folder with my android app. This is what the folder will have开发者_StackOverflow:

I have to bundle a folder with my android app. This is what the folder will have开发者_StackOverflow: 1. a sqlite database with pre-populated data - say a music DB. 2. a few sound files

The database should some how link a column to these sound files(preferably relative paths). I have to expose this db and the sound files to other apps through a content provider.

I got a simple db up in my assets folder and exposed it as a content provider. Where I am stuck is the mp3 part. How do I get to expose the soundfiles to other apps using a content-provider?

I do not want to store the sound files as data blobs in the DB.

I found some info here http://www.techjini.com/blog/2009/01/10/android-tip-1-contentprovider-accessing-local-file-system-from-webview-showing-image-in-webview-using-content/ But wondering how I can get my files to the app internal space in the first place(if i ever have to).

Do I have to do Uri.create, open the stream and then copy the already existing files (in my assets folder/or even the sdcard) one by one to another location, say my application space? ( I might have a 1000 files!)

thanks for any help!

  • nimmi
0

精彩评论

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

关注公众号