Android嵌入式数据库只读

标签 android sqlite

我想为我的 Android 应用程序提供嵌入式数据库。在网上搜索时,我发现人们将其发送到应用程序的 Assets 中,然后在安装时/首次运行时将其复制到其他目录。

就我而言,我需要一个只读数据库,所以我不想制作它的多个副本。是否可以直接从 Assets 中使用它?有没有办法节省空间?

最佳答案

In my case I need a Read-Only DB so I don't want to make multiple copies of it. Is it possible to use it directly from assets? Is there a way to save that space?

没有。 Assets 不是设备中的常规文件,sqlite 库无法直接读取它们。

要么只使用例如复制文件sqlite-asset-helper或者不使用 sqlite 数据库,而使用可以与 AssetManager 提供的 InputStream 配合使用的数据库。

关于Android嵌入式数据库只读,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33342888/

相关文章:

sqlite - 使用 React Native SQLite 存储模块在 SQLite 中使用事务函数创建多个表

javascript - Nativescript 连接文本使用 Label

android vitamio 多个视频查看错误

java - Android在ActionBarActivity中接收广播

java - Java 类之间的消息传递如何最好地完成?

java - 用于 SQLite v2.X 的 sqlite-jdbc

Android-DirectionalViewPager : NoClassDefFoundError: com. orientalviewpager.DirectionalViewPager$DataSetObserver

python - 在 Python 中使用 PyQt 将数据从 sqlite 数据库插入到 QTableWidget

c++ - 为 Windows Mobile 设备编译 SQLite 合并

sql - 同时检索 'count where' 和总计数