如何在 Android 中为我的应用程序创建临时数据库?

发布于 2024-12-29 06:29:50 字数 344 浏览 4 评论 0原文

我的应用程序有一个数据库,该数据库将在应用程序首次运行期间安装/创建。该数据库位于其默认位置,即 /data/data//databases

现在我想在不同的文件夹中创建一个除上述之外的临时数据库,

/data/data/<package_name>/temp

是否可能?如果是,我可以获得相同的代码示例吗?如果没有,除了在 /data/data//databases 中创建临时数据库之外,还有其他方法吗?

I have a database for my application which will be installed/created during the first run of the application. This database is located in its default place i.e. /data/data/<package_name>/databases.

Now I want to create a temp database apart from the above in different folder say

/data/data/<package_name>/temp

Is it possible? If yes, can I get a code example for the same? If no, is there any other way, apart from creating the temp database in /data/data/<package_name>/databases?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不羁少年 2025-01-05 06:29:50

我只需使用 DDMS 或 ADB 从模拟器中提取旧数据库,然后在 /data/data/temp 中再次上传,然后更改代码以访问新的临时数据库。

I'd just pull the old database from the emulator with DDMS or ADB and upload again in /data/data/temp and change your code to access the new temp database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文