sendEmptyMessageAtTime needs an uptime value. Unless your Android device
booted on 1/1/1970, the value you get from Calendar will be off.
28.09.2012 11:32 пользователь "Dmitriy F" <[email protected]> написал:

> A handler that I defined doesn't get a message set with
> sendEmptyMessageAtTime. The time I get from updateTime.getTimeInMillis is
> valid. What am I missing here ?
>
>     @Override
>     protected void onResume() {
>     super.onResume();
>     mNavigationBarFragment.configureFor(0);
>     Calendar updateTime = Calendar.getInstance();
>     updateTime.set(Calendar.YEAR, 2012);
>     updateTime.set(Calendar.HOUR_OF_DAY, 18);
>     updateTime.set(Calendar.MINUTE, 40);
>     updateTime.set(Calendar.SECOND, 0);
>     if(mUpdateOnAirLabel.sendEmptyMessageAtTime(1,
> updateTime.getTimeInMillis())){
>     // messages gets placed
>     }
>     }
>
>     private Handler mUpdateOnAirLabel = new Handler() {
>         public void dispatchMessage(android.os.Message msg) {
>     // doesn't get triggered
> }
>  public void handleMessage(android.os.Message msg) {
>     // doesn't get triggered
> }
>     };
>
> The time I get from the calendar object is right:
>
>     <?php
>
>     echo date("r", 1348753200578 / 1000);
>
> output: Thu, 27 Sep 2012 17:40:00 +0400
>
> After that I've tried to offset from the current timestamp
>
>     Calendar now = Calendar.getInstance();
>     long nowt = now.getTimeInMillis();
>     if(mUpdateOnAirLabel.sendEmptyMessageAtTime(1, now.getTimeInMillis() +
> 5000)){
>             ...
>     }
>
> And it's not triggering either. What's wrong here ?
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to