如何以及在哪里将sqlite(.db)文件添加到android项目中 [英] How and where to add sqlite(.db) file in to an android project

查看:216
本文介绍了如何以及在哪里将sqlite(.db)文件添加到android项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android新手.现在,我正在尝试使用数据库.我有很多关于Sqlite数据库操作的教程.但是我的疑问是,我应该在哪里将.db文件添加到应用程序中.在IDE的程序包浏览器窗口中,我需要在哪个文件夹组下添加.db文件?我希望你能理解我的问题.

I am new to Android. Now, I am trying to work with database. I got many tutorials for manipulating Sqlite database operations. But my doubt is that where should I add the .db file in to the application. In package explorer window of IDE, under which folder group I need to add the .db file? I hope you understand my question.

谢谢.

推荐答案

如果您已经具有 .db 文件,则将该文件放在资产文件夹或原始文件中文件夹

If you already have .db file then put that file in assets folder or raw folder

然后,您必须将该文件复制到路径/your.package.name/data/data 目录中 进一步使用.

Then you have to copy that file at path /your.package.name/data/data directory for further use.

否则,您可以使用代码创建新数据库... 希望这能够帮到你 ...!

Otherwise you can create new database using code... Hope this will help you ...!

请参见示例....

这篇关于如何以及在哪里将sqlite(.db)文件添加到android项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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