
SQLiteDatabase方法生成一个文件,每个应用程序最多对应一个文件dat文件,即.db文件.
您可以使用许多第三方工具来打开和查看的内容.
昨晚我尝试了一些工具,例如navicat,sqlite3,sqlitespy等,但仍然认为sqlitespy更易于使用,并且体积很小,仅为1.7M. 文件管理中有一个相应的sqlitespy. 保存后dat文件,到处都可以找到sqlite打开工具.

前面的SharedPreferences的存储方法类似于Web应用程序中表单的存储.
除了将Android存储在SQLite中之外,SQLiteDatabase与在Oracle中存储数据类似.
注意:

sqlite构建表sql和Oracle在不同的位置:
Oracle:
create table usertb (_id integer primary key autoincrement, name text not null , age integer not null , sex text not null )

或
create or replace table usertb (_id integer primary key autoincrement, name text not null , age integer not null , sex text not null )
sqlite:
create table if not exists usertb (_id integer primary key autoincrement, name text not null , age integer not null , sex text not null )
确保添加如果不存在的判断. 已经有一个需要在sqlite中构建的表,并且如果在构建表时不添加不存在的表,则会出现错误,因为您无法重复构建具有相同表名的表.
MainActivity.java如下:
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/shumachanpin/article-248175-1.html
我们的原则是不惹事人怕事