我可以在不复制到数据库文件夹的情况下从android中的res/asset文件夹打开一个只读数据库 [英] can I open a read alone database from res/asset folder in android without copying to database folder

查看:87
本文介绍了我可以在不复制到数据库文件夹的情况下从android中的res/asset文件夹打开一个只读数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打开一个数据库并从资产或资源文件夹中读取一些值.我不想将任何数据写入DB.由于我的数据库容量很大,因此我无法将其复制到数据库文件夹中,因为它将消耗大量的资源时间和记忆.有帮助吗?

I want to open a database and read some values from asset or resource folder.I don't want to write any data to DB.since my db size is huge I cant copy it to database folder as it will consume lot of time and memory. Any help?

推荐答案

对不起,但这是不可能的. SQLite不能仅使用InputStream来工作,而这只能从资产或原始资源中获得.请记住,资产和资源不是设备上的文件—它们只是您开发计算机上的文件.

Sorry, but this is not possible. SQLite cannot work with purely an InputStream, which is all you can get from an asset or raw resource. Remember that assets and resources are not files on the device — they are only files on your development machine.

这篇关于我可以在不复制到数据库文件夹的情况下从android中的res/asset文件夹打开一个只读数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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