我怎么能重复在Android上的报警器只在周一,周二和周五 [英] How can i Repeat the Alarm in android for only Monday, Tuesday and Friday

查看:111
本文介绍了我怎么能重复在Android上的报警器只在周一,周二和周五的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能重复报警Android中仅周一,周二和周五。

How can i Repeat the Alarm in Android for only Monday, Tuesday and Friday.

Intent myIntent = new Intent(getApplicationContext(), x.class);
            PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 0, myIntent, 0);

                        AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);

                        //Calendar calender = new GregorianCalendar();
                        Calendar calender = Calendar.getInstance();
                        calender.setTimeInMillis(System.currentTimeMillis());
                        calender.set(Calendar.HOUR_OF_DAY, hours);
                        calender.set(Calendar.MINUTE, ireminder.getMin());
                        calender.set(Calendar.SECOND, 0);
                        calender.set(Calendar.MILLISECOND, 0);
                            calender.set(Calendar.DAY_OF_WEEK_IN_MONTH,3);
                             calender.set(Calendar.DAY_OF_WEEK_IN_MONTH,2);
                              calender.set(Calendar.DAY_OF_WEEK_IN_MONTH,6);
 alarmManager.set(AlarmManager.RTC_WAKEUP, calender.getTimeInMillis(), pendingIntent);

但它不是重复3和6天(星期一,星期二和星期五) 你们可以Helpme ???

But it is not repeating for 3 and 6 days (Monday,Tuesday and friday) Can you guys Helpme???

推荐答案

您需要设置3个独立的报警,或让你的报警接收机足够的智慧来安排下一个报警的previous火灾时。在你的情况上面,貌似只有将用于在为6的价值,因为它是最后一个设定值。

You need to set 3 separate alarms, or make your alarm receiver smart enough to schedule the next alarm when the previous fires. In your case above, looks like only the value for "6" would be used, since it is the last value set.

这篇关于我怎么能重复在Android上的报警器只在周一,周二和周五的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆