无论何时(如果过去),我的重复闹钟都会在周日第一次开始,这是问题所在,在下周日闹钟正确重复,我想从下周日开始闹钟..这是我的代码:
AlarmManager alarmMgr = (AlarmManager) activity.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(activity, Alarm.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(activity, 0, intent,PendingIntent.FLAG_UPDATE_CURRENT);
Calendar calendarStart = Calendar.getInstance();
calendarStart.set(Calendar.DAY_OF_WEEK, 1 );
calendarStart.set(Calendar.HOUR_OF_DAY,8);
calendarStart.set(Calendar.YEAR,calendarStart.get(Calendar.YEAR));
calendarStart.set(Calendar.MINUTE, 0);
calendarStart.set(Calendar.SECOND, 0);
Toast.makeText(activity, calendarStart.getTime()+"",Toast.LENGTH_LONG).show();
alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, calendarStart.getTimeInMillis() ,24*60*60*1000, pendingIntent);