使用自定义文件的Andr​​oid SQLite数据库 [英] Using custom file for Android sqlite database

查看:137
本文介绍了使用自定义文件的Andr​​oid SQLite数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能选择的SQLite数据库文件自定义位置?

Is it possible to choose a custom location for the sqlite database file?

如果可能,我想存储在存储卡的数据库文件。如果从一个存储卡向其他用户交换机我想我的应用程序使用可用的卡上的数据库文件的任何版本。

If possible I want to store the database file in the memory card. And if user switches from one memory card to the other I want my application to use whatever version of the database file available on the card.

推荐答案

在默认情况下你的数据库是存储在数据/数据​​/ your_package /数据库

By default your database is stored in data/data/your_package/databases

您可以使用<一个href="http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html"><$c$c>SQLiteDatabase <一href="http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#openOrCreateDatabase%28java.lang.String,%20android.database.sqlite.SQLiteDatabase.CursorFactory%29"><$c$c>openOrCreateDatabase在这里您可以提供的路径的自定义数据库作为第一个参数。

You can use SQLiteDatabase openOrCreateDatabase where you can supply the path to your custom database as your first argument.

这篇关于使用自定义文件的Andr​​oid SQLite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆