1. Extended Class Sqliteopenhelper
Xxsqlitehelper extends Sqliteopenhelper
Public Xxsqlitehelper (Context context,string name,cursorfactory factory,int version) {
Surper (context,name,null,1);
}
OnCreate (Sqlitedatabase db)
Onupgrade (sqlitedatebase db,int newversion,int oldversion)
Cursor c//pointer to query result
C.getstring (C.getcolumindex ("name"))
2. Use
Xxsqlitehelper xx=new Xxsqlitehelper (this);
Sqlitedatabase db=xx.getwritabledatabase ();
Db.insert .....
Db.query ()
Db.close ();
3, Show: Simplecorsoradapter sa=new simplecorsoradapter (this,layout,c,new string[]{"name", "Sex"},new int[]{R.id.iname, R.id.isex});
The requirement table must have a column, _id Integer primary Key AutoIncrement
Refresh the ListView:
Sa.changecorsor (c);
Plug in a mouth: Accessing potentially variable variables in an inner class is not allowed, so it is qualified with the final constant
Android Four: Sqllite