我必须将一个文件夹与我的 Android 应用程序捆绑在一起。该文件夹将包含以下内容:
1. 带有预填充数据的 sqlite 数据库 - 例如音乐数据库。
2.一些声音文件
数据库应该如何将列链接到这些声音文件(最好是相对路径)。
我必须通过内容提供商将此数据库和声音文件公开给其他应用程序。
我在资产文件夹中建立了一个简单的数据库,并将其公开为内容提供者。我被困住的是 mp3 部分。如何使用内容提供程序将声音文件公开给其他应用程序?
我不想将声音文件作为数据块存储在数据库中。
我在这里找到了一些信息 http://www.techjini.com/blog/2009/01/10/android-tip-1-contentprovider-accessing-local-file-system-from-webview-showing-image-in- webview-using-content/ 但想知道如何将我的文件首先发送到应用程序内部空间(如果我必须这样做)。
我是否必须执行 Uri.create,打开流,然后将已经存在的文件(在我的资产文件夹/甚至 SD 卡中)一一复制到另一个位置,比如我的应用程序空间? (我可能有 1000 个文件!)
感谢您的帮助!
I have to bundle a folder with my android app. This is what the folder will have:
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!
发布评论