以下几行有什么区别
(一种)
cal.add(Calendar.MILLISECOND, 0);
(乙)
cal.set(Calendar.MILLISECOND, 0);
Alarm
一旦警报被调用/触发,取消它有多重要?如果我们不取消它会发生什么?
代码
Intent intent = new Intent(this, AlarmReceiver.class);
PendingIntent sender = PendingIntent.getBroadcast(this, i,
intent, PendingIntent.FLAG_UPDATE_CURRENT);
// Get the AlarmManager service
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, triggerInMills, sender);