我的android 第15天 -使用SQLiteOpenHelper获取用于
操作数据库的SQLiteDatabase实例
?
?
public class DatabaseHelper extends SQLiteOpenHelper {
???????? private static final String name ="itcast";//数据库名称
???????? private static final int version = 1; //数据库版本
???????? ......略
}
public class HelloActivity extends Activity {
???@Override public void onCreate(Bundle savedInstanceState) {
??????? ......
??????? Button button =(Button) this.findViewById(R.id.button);
??????? button.setOnClickListener(new View.OnClickListener(){
? publicvoid onClick(View v) {
? DatabaseHelperdatabaseHelper