本文整理汇总了Java中android.os.Handler.postAtTime方法的典型用法代码示例。如果您正苦于以下问题:Java Handler.postAtTime方法的具体用法?Java Handler.postAtTime怎么用?Java Handler.postAtTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Handler
的用法示例。
在下文中一共展示了Handler.postAtTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onAttachedToWindow
import android.os.Handler; //导入方法依赖的package包/类
@Override
protected void onAttachedToWindow()
{
mTickerStopped = false;
super.onAttachedToWindow();
mHandler = new Handler();
/**
* requests a tick on the next hard-second boundary
*/
mTicker = new Runnable()
{
@Override
public void run()
{
if (mTickerStopped)
return;
mCalendar.setTimeInMillis(System.currentTimeMillis());
setText(DateFormat.format(mFormat, mCalendar));
invalidate();
long now = SystemClock.uptimeMillis();
long next = now + (1000 - now % 1000);
mHandler.postAtTime(mTicker, next);
}
};
mTicker.run();
}
示例2: scheduleNextAdvance
import android.os.Handler; //导入方法依赖的package包/类
private void scheduleNextAdvance() {
if (!mIsAutoAdvanceRegistered) {
return;
}
long now = SystemClock.uptimeMillis();
long advanceTime = now + (ADVANCE_INTERVAL - (now % ADVANCE_INTERVAL)) +
ADVANCE_STAGGER * sAutoAdvanceWidgetIds.indexOfKey(getAppWidgetId());
Handler handler = getHandler();
if (handler != null) {
handler.postAtTime(mAutoAdvanceRunnable, advanceTime);
}
}
示例3: queueing
import android.os.Handler; //导入方法依赖的package包/类
protected void queueing(Handler handler){
if (handler != null) {
if (type == NORMAL) {
handler.post(this);
} else if (type == AT_TIME) {
handler.postAtTime(this, time);
} else if (type == DELAY) {
handler.postDelayed(this, time);
} else {}
}
}
示例4: updateSecondsHandler
import android.os.Handler; //导入方法依赖的package包/类
private void updateSecondsHandler() {
if (mClock == null) return;
if (mShowSeconds && mClock.getDisplay() != null) {
mSecondsHandler = new Handler();
if (mClock.getDisplay().getState() == Display.STATE_ON && !mClockHidden) {
mSecondsHandler.postAtTime(mSecondTick,
SystemClock.uptimeMillis() / 1000 * 1000 + 1000);
}
} else if (mSecondsHandler != null) {
mSecondsHandler.removeCallbacks(mSecondTick);
mSecondsHandler = null;
updateClock();
}
}