public final boolean sendEmptyMessageAtTime (int what, long uptimeMillis)Returns true if the message was successfully placed in to the message queue. Returns false on failure, usually because the looper processing the message queue is exiting. you can test the returns 在 2012年9月28日星期五UTC+8下午3时31分50秒,Dmitriy F写道: > > 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 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