自定义数据库到项目 [英] custom database into project

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

问题描述

我已经完成了对Android的网站上的记事本教程。我这样做是因为我想为我的应用程序的DB。一旦我完成我发现其中数据位于DDMS。然后..
我下载我创建了一个小型数据库SQLite的浏览器数据库。知道我是试图把这个数据到我的项目。

I have finished the notepad tutorial on the android site. I did this because i want to create a DB for my app. Once i finished i found out where the data is located in the DDMS. Then.. I downloaded the SQLite browser database i created a mini DB. Know i am trying to put this data into my project.

我可以把这个新的保存数据库文件(我的浏览器制造)到记事本数据库文件和放大器;并删除旧的。所以,当模拟器加载它会载入我的数据。
因为我做了android的记事本数据库的所有code等与此SQLite的浏览器我想到了code为我做(表,列)。

Can i put this new saved database file(i made with browser)into the notepad database file & and delete the old one. So when the emulator loads it will load my data. Because i made a database with android notepad with all the code etc. with this SQLite browser i am thinking the code is done for me(table, columns,)

我猜我问你的是我能不能做一个完整的数据库与SQL浏览器,只是其输入所以如何在我的项目。

I guess am asking you is can i just make a full database with sql browser and just input it so how in my project.

推荐答案

您数据库类必须specifc到您的数据库,所以你不能只是改变后端数据库,并期待您的记事本教程写在处理类前端与它正常工作。

Your database class needs to be specifc to your database, so you cannot just change databases on the back end and expect the handler class you wrote for the notepad tutorial on the front end to work properly with it.

这就是说,你可以建立一个处理程序来运行您的自定义数据库。这是相当圆一个回合虽然。当您获得辅助类创建的,你必须把你的分贝到资产文件夹中。在你的数据库帮助您需要code将文件复制出来的资产,以它的正确的家在您的应用程序数据目录。

That being said, you can create a handler to run your custom db. It's rather round-a-bout though. After you get the helper class created, you have to put your db into the assets folder. In your db helper you need code to copy the file out of assets to it's proper home in your applications data directory.

您可以找到关于如何设置你的数据库,以便在Android框架可以用它适当以及code复制出来资产来说明你的数据目录这里

You can find instructions on how to set up your database so the Android framework can use it properly as well as code for copying it out of assets to your data directory here.

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

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