Ejemplo n.º 1
0
  public void addNoteToTrash(Note note) {

    database = DBHelper.getWritableDatabase();

    ContentValues values = new ContentValues();

    values.put(com.subhrajyoti.babai.noteworthy.DB.DBHelper.COL_NOTE_TITLE_TRASH, note.getTitle());
    values.put(com.subhrajyoti.babai.noteworthy.DB.DBHelper.COL_NOTE_DESC_TRASH, note.getDesc());
    values.put(com.subhrajyoti.babai.noteworthy.DB.DBHelper.COL_NOTE_DATE_TRASH, note.getDate());

    database.insert(com.subhrajyoti.babai.noteworthy.DB.DBHelper.TABLE_NAME_TRASH, null, values);
    database.close();
  }
Ejemplo n.º 2
0
  // Updating single note
  public int updateNote(Note note) {
    SQLiteDatabase db = DBHelper.getWritableDatabase();

    ContentValues values = new ContentValues();

    values.put(com.subhrajyoti.babai.noteworthy.DB.DBHelper.COL_NOTE_TITLE, note.getTitle());
    values.put(com.subhrajyoti.babai.noteworthy.DB.DBHelper.COL_NOTE_DESC, note.getDesc());
    values.put(com.subhrajyoti.babai.noteworthy.DB.DBHelper.COL_NOTE_DATE, note.getDate());

    // updating row
    return db.update(
        com.subhrajyoti.babai.noteworthy.DB.DBHelper.TABLE_NAME,
        values,
        com.subhrajyoti.babai.noteworthy.DB.DBHelper.COL_ID + " = ?",
        new String[] {String.valueOf(note.getId())});
  }