我有一个创建重复警报的活动(设置警报),我需要从另一个活动中取消该警报(取消警报)。我无法取消闹钟。我究竟做错了什么?:
public class settingalarm...
am =(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent alrm = new Intent(context, z.class);
alrm.setAction(ALARM);
alrm.putExtra(x, x);
PendingIntent alarmIntent = PendingIntent.getBroadcast(context, 0, alrm, 0);
am.setRepeating(AlarmManager.RTC_WAKEUP, 0, 30000, alarmIntent);
我有另一个需要取消现有警报的活动:
public class cancelingalarm...
am =(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent alrm = new Intent(context, z.class);
PendingIntent alarmIntent = PendingIntent.getBroadcast(context, 0, alrm, 0);
am.cancel(alarmIntent);
提前致谢!