我想在星期一到星期五发出警报.
我的代码在这里
if (chk_weekday.isChecked()) { int day = calNow.get(Calendar.DAY_OF_WEEK); if (day == 2 || day == 3 || day == 4 || day == 5 || day == 6) { alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calSet.getTimeInMillis(), 1 * 60 * 60 * 1000, pendingIntent); }
有个主意.
解决方法:
请试试这段代码.在我的应用程序中成功运行
if (chk_monday.isChecked()) { forday(2); } else if (chk_tuesday.isChecked()) { forday(3); } else if (chk_wednesday.isChecked()) { forday(4); } else if (chk_thursday.isChecked()) { forday(5); } else if (chk_frIDay.isChecked()) { forday(6); } else if (chk_sat.isChecked()) { forday(7); } else if (chk_sunday.isChecked()) { forday(1); }public voID forday(int week) { calSet.set(Calendar.DAY_OF_WEEK, week); calSet.set(Calendar.HOUR_OF_DAY, hour); calSet.set(Calendar.MINUTE, minuts); calSet.set(Calendar.SECOND, 0); calSet.set(Calendar.MILliSECOND, 0); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calSet.getTimeInMillis(), 1 * 60 * 60 * 1000, pendingIntent); }
总结 以上是内存溢出为你收集整理的如何在android中重复闹钟周日全部内容,希望文章能够帮你解决如何在android中重复闹钟周日所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)