如何在 Android 中为我的应用程序创建临时数据库?
我的应用程序有一个数据库,该数据库将在应用程序首次运行期间安装/创建。该数据库位于其默认位置,即 /data/data/
。
现在我想在不同的文件夹中创建一个除上述之外的临时数据库,
/data/data/<package_name>/temp
是否可能?如果是,我可以获得相同的代码示例吗?如果没有,除了在 /data/data/
中创建临时数据库之外,还有其他方法吗?
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只需使用 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.