包装的SQLite数据库与我的应用程序我的、应用程序、数据库、SQLite

2023-09-05 08:34:17 作者:迩的幸福卟在属于莪

我已经在我的电脑上创建一个SQLite数据库。我已经导入到我的的资产的文件夹中的项目目录。如何从我的Andr​​oid应用程序访问它?

I have created a SQLite database on my PC. I have imported it into my assets folder in the project directory. How do I access it from my Android application?

推荐答案

它复制到你的数据库目录( getDatabasePath())使用Java I / O。在这一点上,你可以使用它像一个正常的数据库。它不可能从自己的资产中使用它。

Copy it into your database directory (getDatabasePath()) using Java I/O. At that point, you can use it like a normal database. It is impossible to use it from within the assets themselves.