直接在资产的文件夹打开一个只读数据库 [英] Opening a read only database directly in the assets folder

查看:104
本文介绍了直接在资产的文件夹打开一个只读数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现在这个网站的许多问题问如何打开位于资产文件夹中的数据库文件。始终将主点 - 正确的 - 答案是一样的:位于资产数据库,不能因为这些文件夹中打开(如APK的全部内容)是只读的。因此数据库文件需要被其他地方复制它可以用于前(<一href="http://stackoverflow.com/questions/513084/how-to-ship-an-android-application-with-a-database">How出货Android应用程序与数据库?)。

I have found in this site many questions asking how to open a database file located in the assets folder. Always the main point of the - correct - answer is the same: databases located in assets cannot be opened since such folder (as the entire content of the APK) is read only. Therefore the database file need to be copied somewhere else before it can be used ( How to ship an Android application with a database? ).

然而,如果实际上在数据库文件没有什么修改?在这种情况下,它并不重要的限制,即资产的文件夹是只读的。

However, what if the database file in fact does not have to be modified ?. In that case it does not matter the restriction that the assets folder is read only.

然后我的问题是:

有没有办法打开一个只读数据库中的资产文件夹中的无需先复制到其他位置

Is there a way to open a read only database in the assets folder without copying it first to another location ?

推荐答案

您需要将它复制到数据文件夹,然后从那里读。

You'll need to copy it to the data folder, then read from there.

这篇关于直接在资产的文件夹打开一个只读数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆