如何添加数据库移动在android系统? [英] How to add database to mobile in android?
问题描述
我目前正在与Android和SQLite数据库工作。我重视数据库偏食例如文件浏览器/数据/数据/ mypackage中/数据库。。这是工作的罚款。但是,当我是数据库附加到数据/ SD卡的移动应用程序来运行。
I am currently working with android and sqlite database. I have attached the database to eclipse like File explorer/data/data/mypackage/database.. This is working fine. But when i am attaching the database to data/sdcard to run the app on mobile.
我得到了空指针异常。没有tableName值ABC是发现。谁能告诉我?为什么发生这种情况,我该如何解决这个问题?
I got the null pointer exception. No tableName Abc is found. Can anybody tell me?? Why this is happening and how can i resolve this problem???
推荐答案
如果你想出货与prebuilt 数据库
您的应用程序,你把它放在你的资产
目录,并在第一次运行你将它复制到 /data/data/your.package/databases
目录。
If you want to ship your application with prebuilt database
, you put it in your assets
directory and on first run you copy it to /data/data/your.package/databases
directory.
请参阅 http://stackoverflow.com/a/11601770/1300995 如何复制数据库
从资产
目录。
See http://stackoverflow.com/a/11601770/1300995 how to copy database
from assets
directory.
这篇关于如何添加数据库移动在android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!