Need to know when it's a new day, i.e., when the time is 00:00:00
I think I read somewhere that there's a system event for when the time changes (each second?) but are there other levels of granularity such as when the hour changes?
I have a TabActivity
for a 7 day TV Guide - the indicator for the first (leftmost) always shows 'Today' with the others showing a three-letter day (Mon, Tue, Wed etc) obviously depending on what the day is today.
What I'd like to do is have t开发者_开发百科he activity 'know' when midnight comes so it pops up a 'Re-loading please wait...' ProgressDialog
and adjusts the indicator on each tab and the associated tab contents.
Is there a built-in system event that can help or is AlarmManager
my best approach?
Your best bet is probably AlarmManager
with a PendingIntent
that sends a broadcast. Then just implement a BroadcastReceiver
to catch the broadcast and update your app. Personally, I've never heard of a built-in broadcast for time changes, but if there is one, you could always just use an if statement to find out if it's the next day.
精彩评论