How to stop reminder in alarm
I have created the reminder in my application. but whenever i click the reminder button it starts playing continuously.but i want after some time stop the alarm(like after 10 or 20 secs). can you please help me fo开发者_开发百科r this.
My Code section
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, date.getMonth());
cal.set(Calendar.YEAR, date.getYear());
cal.set(Calendar.DAY_OF_MONTH, date.getDay());
cal.set(Calendar.HOUR_OF_DAY, date.getHours());
cal.set(Calendar.MINUTE, date.getMinutes() + 5);
use this code to stop alarm. This code is used to cancel an alarm time.
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
alarmManager.cancel(pendingIntent);
精彩评论