Data Storage -- Using Databases[SDK翻译]
public class DictionaryOpenHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 2; private static final String DICTIONARY_TABLE_NAME = "dictionary"; private static final String DICTIONARY_TABLE_CREATE = "CREATE TABLE " + DICTIONARY_TABLE_NAME + " (" + KEY_WORD + " TEXT, " + KEY_DEFINITION + " TEXT);"; DictionaryOpenHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DICTIONARY_TABLE_CREATE); }}
?
示例程序 NotePad 和 字典检索 演示了在 Android 系统中如何操作 SQLite 数据库.
The Android SDK includes a?sqlite3
?database tool that allows you to browse table contents, run SQL commands, and perform other useful functions on SQLite databases. SeeExamining sqlite3 databases from a remote shell?to learn how to run this tool.
在 Android SDK 中包含了一个 sqlite3 的数据库工具, 它允许你浏览表的内容, 运行 SQL 命令, 并在 SQLite 数据库上执行其他一些有用的功能. 查看 Examining sqlite3 databases form a remote shell 学习如何执行这个工具.
?