是否可以为日历 DayOfWeek 参数输入多个值?

Is it possible to do input multiple values for the calendar DayOfWeek parameter?

基本上,我正在创建一个闹钟应用程序,并且想使用 setAlarmClock 方法而不是 setRepeating 来设置一个使用日历实例每天(或者如果可能 select 天)重复出现的闹钟。我想知道您是否可以将 DAY_OF_WEEK 参数设置为多个值,或者一个包含值列表的变量。 我的代码看起来像这样:

AlarmManmager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(this, AlertReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 1, intent, 0);
Calendar c = Calendar.getInstance();
    c.set(Calendar.DAY_OF_WEEK, //some variable with multiple day values here);
    c.set(Calendar.HOUR_OF_DAY, hourOfDay);
    c.set(Calendar.MINUTE, minute);
    c.set(Calendar.SECOND, 2);
AlarmManager.AlarmClockInfo ac= new AlarmManager.AlarmClockInfo(c.getTimeInMillis(),pendingIntent);

非常感谢您的帮助, 谢谢!

您可以使用 TimesSquare 库和 CalendarPickerView 选择多个日期,如此处 GitHub 所示。

基本上使用这个库,您可以在一个 CalendarPicker 中选择多个日期,并将所有选定的日期作为日期列表获取。