标签:
关键词:sqlite数据库,listview,数据适配器,内容提供者
sqlite数据库:SQLiteOpenHelper类;SQLiteDatabase;
SQLiteOpenHelper:A helper class to manage database creation and version management.
SQLiteDatabase:Exposes methods to manage a SQLite database.
两者的关系:SQLiteDatabase db = helper.getWritableDatabase();
ContentValues:增删改查数据库是数据存放在ContentValues中;
conmands:(sql语句实现增删改查)
insert into account (name,money) values (String,String)
select * from account
update account set money =‘19‘ where id=‘1‘
delete from account where id=‘1
系统api实现增删改查
db.insert(),db.update()...
数据库的事务:银行转账为例,让两边同时改变数据库的值才能生效
db.beginTransaction(); try { ... db.setTransactionSuccessful(); } finally { db.endTransaction(); }
listview:
View view=View.inflate(MainActivity.this, R.layout.list_item, null);
把xml文件转换成view对象,作为listview的单元。
内容提供者:待续
标签:
原文地址:http://www.cnblogs.com/buptee/p/4700248.html