Android 启动多个闹钟。

Intent i=new Intent(TimeSetActivity.this,AlarmReceiver.class);  
PendingIntent pi = PendingIntent.getBroadcast(TimeSetActivity.this, Integer.valueOf(id) , i, 0); //通过getBroadcast第二个参数区分闹钟,将查询得到的note的ID值作为第二个参数。

AlarmManager am = (AlarmManager) getSystemService(Activity.ALARM_SERVICE); 
am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pi);//设置闹铃 

 

Intent i=new Intent(TimeSetActivity.this,AlarmReceiver.class);
PendingIntent pi = PendingIntent.getBroadcast(TimeSetActivity.this, Integer.valueOf(id) , i, 0);     
am.cancel(pi);//取消闹钟

 

posted @ 2015-11-11 16:33  别人眼中的过客  阅读(1087)  评论(0编辑  收藏  举报