當前位置: 首頁>>代碼示例>>Java>>正文


Java Handler.removeCallbacksAndMessages方法代碼示例

本文整理匯總了Java中android.os.Handler.removeCallbacksAndMessages方法的典型用法代碼示例。如果您正苦於以下問題:Java Handler.removeCallbacksAndMessages方法的具體用法?Java Handler.removeCallbacksAndMessages怎麽用?Java Handler.removeCallbacksAndMessages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.os.Handler的用法示例。


在下文中一共展示了Handler.removeCallbacksAndMessages方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: TextViewLinkHandler

import android.os.Handler; //導入方法依賴的package包/類
public TextViewLinkHandler(ClickableText clickableText, String subreddit, Spannable sequence) {
    this.clickableText = clickableText;
    this.subreddit = subreddit;
    this.sequence = sequence;

    clickHandled = false;
    handler = new Handler();
    longClicked = new Runnable() {
        @Override
        public void run() {
            // long click
            clickHandled = true;

            handler.removeCallbacksAndMessages(null);
            if (link != null && link.length > 0 && link[0] != null) {
                TextViewLinkHandler.this.clickableText.onLinkLongClick(link[0].getURL(), event);
            }

        }
    };
}
 
開發者ID:ccrama,項目名稱:Slide-RSS,代碼行數:22,代碼來源:TextViewLinkHandler.java

示例2: stopAnimAndRemoveCallbacks

import android.os.Handler; //導入方法依賴的package包/類
private void stopAnimAndRemoveCallbacks(){
    isStart=false;
    for (Map.Entry<String, ValueAnimator> entry : animMap.entrySet()) {
        entry.getValue().end();
    }
    Handler handler=this.getHandler();
    if (handler!=null){
        handler.removeCallbacksAndMessages(null);
    }
}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:11,代碼來源:WeatherView.java

示例3: suicaMaker

import android.os.Handler; //導入方法依賴的package包/類
protected void suicaMaker(int time) {
    mScore = 0;
    mRunning = true;
    mLimitTime = time;
    final int diffTime = 2000;

    suicaRunnable = new Runnable() {
        @Override
        public void run() {
            addSuica();
            if (TIME_LIMIT - mTimerCnt < 0) {
                mRunning = false;

                showRankingDialog();
                backGround.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        showRankingDialog();
                    }
                });

            }
            if(mRunning) {
                int offsetParam = mDoitsu ? 100 : 600;
                long offset = Math.max(-mDiffLimit, - mScore / offsetParam);
                suicaHandler.postDelayed(suicaRunnable, diffTime + offset);
            } else {
                suicaHandler.removeCallbacksAndMessages(null);
            }
        }
    };
    suicaHandler = new Handler();
    suicaHandler.postDelayed(suicaRunnable, diffTime);


    mTimerText.setText("00:00.0");
    mTimerCnt = 0;

    mClockRunnable = new Runnable() {
        @Override
        public void run() {
            suicaHandler.post(new Runnable() {
                public void run() {
                    mTimerCnt+=1000;
                    int t = TIME_LIMIT - mTimerCnt;
                    if(t >= 0) {
                        t /= 1000;
                    } else {
                        t = 0;
                    }
                    long mm = t / 60;
                    long ss = t % 60;
                    mTimerText.setText(String.format("%1$02d:%2$02d", mm, ss));
                }
            });
            suicaHandler.postDelayed(mClockRunnable, 1000);
        }
    };
    suicaHandler.postDelayed(mClockRunnable, 0);
}
 
開發者ID:ShitamatsugeFactory,項目名稱:KokoWalk,代碼行數:61,代碼來源:NaginataActivity.java


注:本文中的android.os.Handler.removeCallbacksAndMessages方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。