本文整理汇总了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);
}
}
};
}
示例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);
}
}
示例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);
}