1
因此,我的應用程序從數據庫中設置了報警,但是我希望能夠在這些報警(用於藥物治療)上設置失效日期。我將如何做到這一點?使報警失效
這裏是我的報警代碼:
private void calMeds(int medication1, String time1) {
String string = time1;
String[] parts = string.split(":");
String part1 = parts[0];
String part2 = parts[1];
Log.e("DATABASE", "Hours: " + part1);
Log.e("DATABASE", "Minutes: " + part2);
hourCorrect = Integer.parseInt(part1);
minuteCorrect = Integer.parseInt(part2);
Date date = new Date();
Calendar cal_Alarm = Calendar.getInstance();
Calendar cal_Now = Calendar.getInstance();
cal_Now.setTime(date);
cal_Alarm.setTime(date);
cal_Alarm.set(Calendar.HOUR_OF_DAY, hourCorrect);
cal_Alarm.set(Calendar.MINUTE, minuteCorrect);
cal_Alarm.set(Calendar.SECOND, 3);
if (cal_Alarm.before(cal_Now)) {
cal_Alarm.add(Calendar.DATE, 1);
}
alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
String ALARM_ACTION;
如果我有一個鬧鐘每天在9:00去滅,到期日是三月21日,我該如何阻止它從後這一令人震驚日期?時間被輸入到數據庫中,並且每個都有不同的到期日期。
我想這個問題被誤解了,我會編輯它.. – una 2013-03-19 18:58:29