本文介绍了如何改变在Android数据库存储路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要如何改变在Android数据库存储路径?用于数据库存储的默认路径为/数据/数据/数据库,我想将它保存到SD卡,怎么办?
How do I change the android database storage path? The default path for database storage is / data / data / databases,I want to save it to sdcard, how to do?
推荐答案
的SQLite的的openDatabase()
让你为你的数据库提供一个位置。
SQLite's openDatabase()
lets you provide a location for your database.
您应该使用 Context.getExternalFilesDir()找到,而不是硬编码的SD卡的路径,但。这种联系有一些不错的code样,你应该充分利用。
You should use Context.getExternalFilesDir() to find the SD card's path instead of hardcoding it, though. That link has some nice code samples which you should make use of.
这篇关于如何改变在Android数据库存储路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!