tpAddEvent.getCurrentHour() returns 24 hour format.

 

I updated Calendar.HOUR to Calendar.HOUR_OF_DAY but I have the same issue

 

From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Nobu Games
Sent: Monday, July 02, 2012 5:51 PM
To: android-developers@googlegroups.com
Subject: [android-developers] Re: AlarmManager not waiting to fire off
alarm...

 

Just an educated guess. The documentation about the get method states, that
alarm dates in the past will be triggered immediately, which is your case.

Following line might be the problem because of a possibly wrong 12 / 24 hour
conversion:

   cal.set(Calendar.HOUR, tpAddEvent.getCurrentHour());

What does tpAddEvent return? Is it in "hour of day" format? Then you need to
rewrite the line to

   cal.set(Calendar.HOUR_OF_DAY, tpAddEvent.getCurrentHour());

If it is in 12 hour format, then you must also set AM/PM on your calendar:

   cal.set(Calendar.AM_PM, tpAddEvent.isAM() ? Calendar.AM : Calendar.PM);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to