コード例 #1
0
  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();
  }
コード例 #2
0
  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();
  }
コード例 #3
0
  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;
  }
コード例 #4
0
  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;
  }