unsetAlarm(application, time);
}
- public static long[] getAlarmsByEvent(final Application application, final long eventId) throws SQLException{
+ public static Long[] getAlarmsByEvent(final Application application, final long eventId) throws SQLException{
final SQLiteDatabase db = application.alarmOpenHelper.getWritableDatabase();
+ db.delete(AlarmOpenHelper.TABLE, AlarmOpenHelper.TIME + " < " + System.currentTimeMillis(), new String[0]);
final Cursor cursor = db.query(AlarmOpenHelper.TABLE, new String[]{AlarmOpenHelper.TIME}, AlarmOpenHelper.EVENT + " = " + eventId, new String[0], null, null, null);
if(cursor.moveToFirst()){
- final long[] ret = new long[cursor.getCount()];
+ final Long[] ret = new Long[cursor.getCount()];
for(int i=0;i<ret.length;i++){
- ret[i]=cursor.getLong(i);
+ ret[i]=cursor.getLong(0);
cursor.moveToNext();
}
return ret;
}
- return new long[0];
+ return new Long[0];
}
public static void setAlarm(final Context context, final long time, final long eventId){