1.首先新建项目,打开项目,运行程序。在data/data下面找到刚刚新建的项目。在新建的项目里面创建数据库。eg:com.example.111
2.找到SDK文件内的platform-tools
3.输入cmd进入命令提示符
4.命令提示符内代码
D:\Sdk\platform-tools>adb shell
//登录android设备的shell环境
root@generic_x86:/ # mkdir /data/data/com.example.111
mkdir failed for /data/data/com.example.111, File exists
255|root@generic_x86:/ # mkdir /data/data/com.example.111/database
//创建database文件夹
root@generic_x86:/ # cd /data/data/com.example.111/database
//进入database文件夹
root@generic_x86:/data/data/com.example.111/database # sqlite3 hhh
//创建数据库hhh
SQLite version 3.8.6 2014-08-15 11:46:33
Enter ".help" for usage hints.
sqlite> create table user
//创建user表
...> (id integer primary key autoincrement,
//id 为主键
...> name text not null,
//姓名
...> pwd text);
//密码
sqlite> .tables
user
sqlite> .schema
CREATE TABLE user
(id integer primary key autoincrement,
name text not null,
pwd text);
sqlite> insert into user values(1,'hst','123');
sqlite> insert into user values(2,'ly','456');
//添加
sqlite> select * from user;
//查询
1|hst|123
2|ly|456
sqlite>update user set id=5 where id=1;
//修改
sqlite>delete from user where id=2;
//删除
5.创建数据库完成