@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.d(TAG, "onUpgrade()"); for (Table table : DbMetadata.sTableList) { String sql = DbHelper.getDropTableStatement(table); db.execSQL(sql); } onCreate(db); }
@Override public void onCreate(SQLiteDatabase db) { Log.d(TAG, "onCreate()"); for (Table table : DbMetadata.sTableList) { String sql = DbHelper.getCreateTableStatement(table); db.execSQL(sql); } Set<String> keySet = DbMetadata.sValueMap.keySet(); for (String table : keySet) { ArrayList<ContentValues> valueList = DbMetadata.sValueMap.get(table); if (valueList == null) { continue; } for (ContentValues value : valueList) { db.insert(table, null, value); } } }