开发者

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜