如何将现有的数据库中的.apk文件?数据库中、如何将、文件、apk

2023-09-13 00:54:59 作者:泪已干、心已碎

我主要是字符串对象的prebuild数据库。我想知道如何把我的apk文件,以便当用户安装数据库的数据库将已经创建。

I have prebuild database of mostly string objects. I want to know how to put in my apk file so the database will be already created when the user installs the database.

推荐答案

我发现这是一个很好的例子:的使用的Andr​​oid应用程序你自己的SQLite数据库

I found a good example of this: Using your own SQLite database in Android applications

基本上,你所创建的数据库中导出为一个SQL文件,并将其存储在资产文件夹。 在第一个节目开始,你导入的文件中的数据到最终数据库。

Basically, you export the created database as an sql-file and store it in the assets-folder. On the first program start, you import the data of the file into your final database.

我认为这是最好的方法,但是你的数据将有两次在APK和数据库,使用一些更多的存储空间。

I think it's the best approach, however your data will be there twice in the apk and the db, using some more storage space.