Ejemplo n.º 1
0
  public int updateByID(Alarm alarm) {
    liteDB = getWritableDatabase();

    ContentValues values = new ContentValues();
    values.put("title", alarm.getTitle());
    values.put("hour", alarm.getHour());
    values.put("minute", alarm.getMinute());
    values.put("music_path", alarm.getMusic_path());
    values.put("extra_data", alarm.getExtra_data());
    values.put("sonn_time", alarm.getSonn_time());

    return liteDB.update(TABLE_NAME, values, "id", new String[] {alarm.getId() + ""});
  }
Ejemplo n.º 2
0
  /**
   * 添加
   *
   * @param alarm
   * @return
   */
  public long save(Alarm alarm) {
    liteDB = getWritableDatabase();

    ContentValues values = new ContentValues();
    values.put("title", alarm.getTitle());
    values.put("hour", alarm.getHour());
    values.put("minute", alarm.getMinute());
    values.put("music_path", alarm.getMusic_path());
    values.put("extra_data", alarm.getExtra_data());
    values.put("sonn_time", alarm.getSonn_time());

    return liteDB.insert(TABLE_NAME, null, values);
  }