我累了查找有關報警的具體日子,總是天天跑懇求誰可以幫我 並使用這些代碼,這個是什麼錯誤,運行每所以我發送dayOfWeek = 1;但每天跑報警在特定日子不是每天例如重複(週日,週二,週五)
public void setAlarm(int dayOfWeek) {
Toast.makeText(getApplicationContext(), dayOfWeek+","+h+","+m, 22222).show();
cal1.set(Calendar.DAY_OF_WEEK, dayOfWeek);
cal1.set(Calendar.HOUR, 11);
cal1.set(Calendar.MINUTE, 0);
cal1.set(Calendar.SECOND, 0);
cal1.set(Calendar.MILLISECOND, 0);
Intent intent = new Intent(this, RemmemberActivity.class);
PendingIntent pendingIntent0 = PendingIntent.getBroadcast(this, 0,
intent, 0);
pendingIntent = PendingIntent.getActivity(this, 12345,
intent, PendingIntent.FLAG_UPDATE_CURRENT);
Long alarmTime = cal1.getTimeInMillis();
am = (AlarmManager) getSystemService(Activity.ALARM_SERVICE);
am.setRepeating(AlarmManager.RTC_WAKEUP, alarmTime,24 * 60 * 60 * 1000 , pendingIntent);
}
確定,但我沒有固定3天(太陽,週二,週五),可能是三個不同天根據複選框選擇像一個(週一,週三,週六) – 2014-09-14 06:51:32
好吧,我用這條線和每週六罰款am.setRepeating(AlarmManager.RTC_WAKEUP,alarmTime,7 * 24 * 60 * 60 * 1000,pendingIntent);但怎麼可以設置每個星期天 – 2014-09-14 07:41:03
謝謝你的幫助:) :) – 2014-09-14 08:32:49