管理一个Android数据库 [英] Managing an Android database

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

问题描述

我所有我发现教程希望实现我的第一个Android数据库,但我有(我相信)这么多的问题都没有答案。

I'm looking to implement my first Android database, but I have so many questions which (I believe) are unanswered by all the tutorials I find.

下面是我的需求:
- 我想我的应用程序有一个数据库是持久性的。如果我的应用程序关闭并重新启动,已经有一个数据库,从中提取数据。它不创建一个新的数据库中的每个应用程序被终止,并重新启动的时间。
- 我想要实现的版本。说我的应用程序的版本1有几桌。我Release版本2,我需要某种脚本的运行增添我已经添加了新表或修改我添加了旧表;等等等等。应用程序必须知道数据库是否处于一个特定版本(这意味着我需要在数据库中的表),所以它知道是否要运行此脚本。

Here are my needs: - I want my application to have a database that is persistent. If my application closes and launches again, there is already a database to pull data from. It does not create a new database every time the application is killed and re-launched. - I want to implement versioning. Say version 1 of my application has a few tables. I release version 2 and I want some sort of script to run to add new tables I've added or modify old tables I've added; and so on and so forth. The application has to know whether the database is at a particular version (which means I'll need a table in the database) so it knows whether to run this script.

能不能有人为我提供一些资源,所以我可以弄清楚如何做我需要?谢谢

Could someone provide me with some resources so I can figure out how to do what I need? Thank you

推荐答案

找源码+机器人+教程:

Look for sqlite+android+tutorial:

HTTP://www.hdelossantos .COM / 2009/12/23 /创建-A-sqlite的数据库,在机器人/

HTTP://www.hdelossantos .COM / 2010/01/07 /使用-A-sqlite的数据库,在机器人/

和多一些:

http://www.google.com.hk/search?sourceid=chrome&ie=UTF-8&q=android+sqlite+tutorial

有也来与SDK中的示例程序的样品,即记事本应用程序。

There is also a sample in the sample programs that come with the SDK, i.e. the Notepad app.

和官方开发者API文档 - 但是这更象是一个参考,不作为教程:
http://developer.android.com/reference/android/database/sqlite/package-summary.html

And the official developer api doc - but that's more as a reference, not as tutorial: http://developer.android.com/reference/android/database/sqlite/package-summary.html

这篇关于管理一个Android数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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