@Override public void onCreate(SQLiteDatabase db) { // Create the database db.execSQL(QUERY_CREATE); // Insert the sample shaders for (ShaderDescription shader : sampleShaders) db.insert(TABLE_SHADERS, null, shader.getContentValues()); }
/** * Add a shader to the database, and save its contents locally. * * @param shaderDescription The shader that should be saved. */ public void save(ShaderDescription shaderDescription) { // If an entry exists with the same path, do not write to the database. if (exists(shaderDescription.getPath())) return; // Obtain a writable database instance SQLiteDatabase database = getWritableDatabase(); // Obtain the ContentValues that represent the passed Subject ContentValues values = shaderDescription.getContentValues(); // Insert the new values into the table database.insert(TABLE_SHADERS, null, values); database.close(); }