如何将数据库保存在SD卡上并使用ORMLite?

时间:2022-04-03 16:50:50

I use ORMLite to work with my database, and I faced with problem how keep database on sd card. Can anyone help me with this?

我使用ORMLite处理我的数据库,并且遇到了如何将数据库保存在sd卡上的问题。有人能帮我一下吗?

2 个解决方案

#1


4  

you can simply add the /sdcard/ string before your database name and it will work fine

您可以简单地在数据库名之前添加/sdcard/ string,它将正常工作

#2


1  

Not sure what ORM Lite is and never used it.

不确定ORM Lite是什么,也从未使用过它。

However, by default Android will place your database in /data/data/PACKAGE/databases/DATABASEFILE on your storage device. If you don't like that location, you can follow this article and relocate your database to wherever you want.

但是,默认情况下,Android会将你的数据库放在/数据/数据/包/数据库/数据库文件上。如果您不喜欢这个位置,您可以跟踪本文并将数据库迁移到您想要的地方。

#1


4  

you can simply add the /sdcard/ string before your database name and it will work fine

您可以简单地在数据库名之前添加/sdcard/ string,它将正常工作

#2


1  

Not sure what ORM Lite is and never used it.

不确定ORM Lite是什么,也从未使用过它。

However, by default Android will place your database in /data/data/PACKAGE/databases/DATABASEFILE on your storage device. If you don't like that location, you can follow this article and relocate your database to wherever you want.

但是,默认情况下,Android会将你的数据库放在/数据/数据/包/数据库/数据库文件上。如果您不喜欢这个位置,您可以跟踪本文并将数据库迁移到您想要的地方。