2 curie 87 curie_87 于 2013.04.24 10:34 提问

使用 alarm manager 如何设置闹钟

我试着在星期一的时候设置一个闹铃,但是没起作用,如何在周一设置一个闹铃,并且只响一次呢?

if (chk_wednesday.isChecked()) {
                        weekday = 7 - calNow.get(Calendar.DAY_OF_WEEK);
                        calSet.add(Calendar.DATE, weekday);
                        forday(weekday);
                        }


public void forday(int week) {

                days = calNow.get(Calendar.DAY_OF_MONTH);
                month = calNow.get(Calendar.MONTH);
                year = calNow.get(Calendar.YEAR);

        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);

        calSet.set(Calendar.DAY_OF_MONTH, days);
        calSet.set(Calendar.MONTH, month);
        calSet.set(Calendar.YEAR, year);

        if (calSet.compareTo(calNow) <= 0) {
            // Today Set time passed, count to tomorrow
            calSet.add(Calendar.DATE, 1);
        }
        Log.i("time1", "" + calSet.getTimeInMillis());
        alarmManager.set(AlarmManager.RTC_WAKEUP, calSet.getTimeInMillis(),
                pendingIntent);
    }

1个回答

daijianbo369
daijianbo369   2013.05.06 11:10
已采纳

第二的的提示音要打开日历,菜单,设置,把提示音改掉就行

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!