app/src/main/java/com/kevinrei/chronotrack/MySQLiteHelper.java
// Add new details for an alarm
Add new details for an alarm
Add new details for an alarm
public void addAlarm(Alarm alarm) {
        SQLiteDatabase db = this.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put(KEY_ALARM_ID, alarm.getAlarmId());
        values.put(KEY_GAME_ID, alarm.getGameId());
        values.put(KEY_FLAG, alarm.getFlag());
        values.put(KEY_START, alarm.getStart());
        values.put(KEY_END, alarm.getEnd());
        values.put(KEY_TRIGGER, alarm.getTrigger());
        values.put(KEY_COUNTDOWN, alarm.getCountdown());
        values.put(KEY_LABEL, alarm.getLabel());
        values.put(KEY_SAVE, alarm.getSave());
        db.insert(TABLE_ALARMS, null, values);
        Log.d(TAG_ALARM, alarm.toString());
        db.close();
    }
public void addAlarm ( Alarm alarm ) { SQLiteDatabase db = this . getWritableDatabase ( ) ; ContentValues values = new ContentValues ( ) ; values . put ( KEY_ALARM_ID , alarm . getAlarmId ( ) ) ; values . put ( KEY_GAME_ID , alarm . getGameId ( ) ) ; values . put ( KEY_FLAG , alarm . getFlag ( ) ) ; values . put ( KEY_START , alarm . getStart ( ) ) ; values . put ( KEY_END , alarm . getEnd ( ) ) ; values . put ( KEY_TRIGGER , alarm . getTrigger ( ) ) ; values . put ( KEY_COUNTDOWN , alarm . getCountdown ( ) ) ; values . put ( KEY_LABEL , alarm . getLabel ( ) ) ; values . put ( KEY_SAVE , alarm . getSave ( ) ) ; db . insert ( TABLE_ALARMS , null , values ) ; Log . d ( TAG_ALARM , alarm . toString ( ) ) ; db . close ( ) ; }
Add new details for an alarm
Add new details for an alarm
// Get reference to a writable database // Create ContentValues to add key "column"/value // Insert to database // Close the database