public void removeItemWithId(int id) { SQLiteDatabase db = getWritableDatabase(); String[] whereArgs = {String.valueOf(id)}; db.delete(RecordingDatabaseItem.TABLE_NAME, "_id=?", whereArgs); if (mOnDatabaseChangedListener != null) mOnDatabaseChangedListener.onDatabaseEntryUpdated(); }
public void renameItem(RecordingItem item, String recordingName) { SQLiteDatabase db = getWritableDatabase(); ContentValues values = new ContentValues(); values.put(RecordingDatabaseItem.COLUMN_NAME_RECORDING_NAME, recordingName); db.update( RecordingDatabaseItem.TABLE_NAME, values, RecordingDatabaseItem._ID + "=" + item.getId(), null); if (mOnDatabaseChangedListener != null) mOnDatabaseChangedListener.onDatabaseEntryUpdated(); }
public long addRecording(String recordingName, String filePath, long length) { SQLiteDatabase db = getWritableDatabase(); ContentValues values = new ContentValues(); values.put(RecordingDatabaseItem.COLUMN_NAME_RECORDING_NAME, recordingName); values.put(RecordingDatabaseItem.COLUMN_NAME_RECORDING_FILE_PATH, filePath); values.put(RecordingDatabaseItem.COLUMN_NAME_RECORDING_LENGTH, length); values.put(RecordingDatabaseItem.COLUMN_NAME_TIME_ADDED, System.currentTimeMillis()); long rowId = db.insert(RecordingDatabaseItem.TABLE_NAME, null, values); if (mOnDatabaseChangedListener != null) mOnDatabaseChangedListener.onDatabaseEntryUpdated(); return rowId; }
public long restoreRecording(RecordingItem item) { SQLiteDatabase db = getWritableDatabase(); ContentValues values = new ContentValues(); values.put(RecordingDatabaseItem.COLUMN_NAME_RECORDING_NAME, item.getName()); values.put(RecordingDatabaseItem.COLUMN_NAME_RECORDING_FILE_PATH, item.getFilePath()); values.put(RecordingDatabaseItem.COLUMN_NAME_RECORDING_LENGTH, item.getLength()); values.put(RecordingDatabaseItem.COLUMN_NAME_TIME_ADDED, item.getTime()); values.put(RecordingDatabaseItem._ID, item.getId()); long rowId = db.insert(RecordingDatabaseItem.TABLE_NAME, null, values); if (mOnDatabaseChangedListener != null) mOnDatabaseChangedListener.onDatabaseEntryUpdated(); return rowId; }