public int update(Alarm alarm) { ContentValues values = new ContentValues(); values.put(COLUMN_ALARM_MUSIC, alarm.getMusic()); values.put(COLUMN_ALARM_TIME, alarm.getTimeString()); try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(alarm.getDays()); byte[] buff = bos.toByteArray(); values.put(COLUMN_ALARM_DAYS, buff); } catch (Exception e) { } values.put(COLUMN_ALARM_NAME, alarm.getName()); values.put(COLUMN_ALARM_VIBRATE, alarm.getVibrate()); values.put(COLUMN_ALARM_ACTIVE, alarm.getActive()); values.put(COLUMN_ALARM_MUSICTYPE, alarm.getMusicType()); values.put(COLUMN_ALARM_MUSICNAME, alarm.getMusicName()); return getDatabase().update(ALARM_TABLE, values, COLUMN_ALARM_ID + "=" + alarm.getId(), null); }
public int deleteEntry(Alarm alarm) { return deleteEntry(alarm.getId()); }