0
我正在做一個報警應用程序,根據從日期選擇器的日期和時間它必須發揮警報。我曾寫過故障在啓動報警
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month);
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.HOUR, hour);
cal.set(Calendar.MINUTE, min);
//Create a new PendingIntent and add it to the AlarmManager
Intent intent = new Intent(this, AlarmReceiverActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this,
0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager am =
(AlarmManager)getSystemService(Activity.ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
pendingIntent);
除了在砑光機設置值
代碼如果我們硬編碼像cal.add值(Calendar.SECOND,5);它發揮警報..如果有人請幫我找到問題。
日曆的值是否已正確初始化? – Egor 2013-02-18 11:57:56
是的..如果我們敬酒它顯示 – ammukuttylive 2013-02-18 11:58:43