here is my database helper class:
public DbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
Log.i("Database", "DATABASE CREATE");
db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" + KEY_ROWID
+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_NAME
+ " VARCHAR NOT NULL, " + KEY_HOTNESS
+ " VARCHAR NOT NULL);"
);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
Log.i("Database", "DATABASE CREATE");
db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
onCreate(db);
}
}
is there any way insert a default database entries when you first opened the application. like its inside the onCreate/onUpgrade method?
db.qxecSQL()statements should be executed on each and every start of the application ?