android.os.CountDownTimer.cancel()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(192)

本文整理了Java中android.os.CountDownTimer.cancel()方法的一些代码示例,展示了CountDownTimer.cancel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CountDownTimer.cancel()方法的具体详情如下:
包路径:android.os.CountDownTimer
类名称:CountDownTimer
方法名:cancel

CountDownTimer.cancel介绍

暂无

代码示例

代码示例来源:origin: guardianproject/haven

public void stopHeartbeatTimer ()
{
  mCountdownTimer.cancel();
  mCountdownTimer = null;
  Log.d("HEARTBEAT TIMER", "Stopped" );
}

代码示例来源:origin: guardianproject/haven

private void showSettings() {
  Intent i = new Intent(this, SettingsActivity.class);
  if (cTimer != null) {
    cTimer.cancel();
    cTimer = null;
    startActivityForResult(i, REQUEST_TIMER);
  } else {
    startActivity(i);
  }
}

代码示例来源:origin: guardianproject/haven

private void doCancel() {
  boolean wasTimer = false;
  if (cTimer != null) {
    cTimer.cancel();
    cTimer = null;
    mOnTimerTicking = false;
    wasTimer = true;
  }
  if (mIsMonitoring) {
    mIsMonitoring = false;
    stopService(new Intent(this, MonitorService.class));
    finish();
  } else {
    findViewById(R.id.btnStartNow).setVisibility(View.VISIBLE);
    findViewById(R.id.timer_text_title).setVisibility(View.VISIBLE);
    ((Button) findViewById(R.id.btnStartLater)).setText(R.string.start_later);
    int timeM = preferences.getTimerDelay() * 1000;
    txtTimer.setText(getTimerText(timeM));
    if (!wasTimer)
      finish();
  }
}

代码示例来源:origin: devinhu/androidone

/**
 * [停止倒计时功能]<BR>
 */
public void stopDown(){
  if(mCountDownTimer != null){
    mCountDownTimer.cancel();
    listener = null;
    mCountDownTimer = null;
  }
}

代码示例来源:origin: gearvrf/GearVRf-Demos

@Override
  public void run() {
    mCountDownTimer.cancel();
  }
});

代码示例来源:origin: sealtalk/sealtalk-android

/**
 * [停止倒计时功能]<BR>
 */
public void stopDown() {
  if (mCountDownTimer != null)mCountDownTimer.cancel();
}

代码示例来源:origin: vilyever/AndroidSocketClient

self.hearBeatCountDownTimer.cancel();

代码示例来源:origin: kevalpatel2106/Prevent-Screen-Off

void stopLightMonitoring() {
    mSensorManager.unregisterListener(listener);

    //stop the timer if running
    if (mCountDownTimer != null) mCountDownTimer.cancel();
  }
}

代码示例来源:origin: sarveshchavan7/Quiz-Game

@Override
protected void onPause() {
  super.onPause();
  countDownTimer.cancel();
}

代码示例来源:origin: openwalletGH/openwallet-android

void onStopTradeCountDown() {
  if (countDownTimer != null) {
    countDownTimer.cancel();
    countDownTimer = null;
    handler.removeMessages(START_TRADE_TIMEOUT);
    handler.removeMessages(UPDATE_TRADE_TIMEOUT);
    handler.removeMessages(TRADE_EXPIRED);
  }
}

代码示例来源:origin: Coinomi/coinomi-android

void onStopTradeCountDown() {
  if (countDownTimer != null) {
    countDownTimer.cancel();
    countDownTimer = null;
    handler.removeMessages(START_TRADE_TIMEOUT);
    handler.removeMessages(UPDATE_TRADE_TIMEOUT);
    handler.removeMessages(TRADE_EXPIRED);
  }
}

代码示例来源:origin: huntermr/FastAndroid

/**
   * 停止倒计时
   */
  public void stopCountDown(){
    countDownTimer.cancel();
    countDownTimer.onFinish();
  }
}

代码示例来源:origin: stackoverflow.com

for(CountDownTimer t : mFadeTimers){
  Log.d("tag", "Cancelling fade timer on destroy."); // ought to read "in onPause", right?
  t.cancel();
  t.onFinish();
}
mFadeTimers.clear();

代码示例来源:origin: attentiveness/News

@Override
  protected void onDestroy() {
    super.onDestroy();
    if (mTimer != null) {
      mTimer.cancel();
      mTimer = null;
    }
  }
}

代码示例来源:origin: ChillingVan/android-openGL-canvas

@Override
protected void onDestroy() {
  super.onDestroy();
  countDownTimer.cancel();
  if (mediaPlayer.isPlaying()) {
    mediaPlayer.release();
  }
}

代码示例来源:origin: BuildmLearn/BuildmLearn-Toolkit-Android

@Override
  public boolean onMenuItemClick(MenuItem item) {
    Bundle arguments = new Bundle();
    arguments.putString(Intent.EXTRA_TEXT, String.valueOf(finalI));
    countDownTimer.cancel();
    Fragment frag = QuestionFragment.newInstance();
    frag.setArguments(arguments);
    getActivity().getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
    getActivity().getSupportFragmentManager().beginTransaction().replace(((ViewGroup) getView().getParent()).getId(), frag).addToBackStack(null).commit();
    return false;
  }
});

代码示例来源:origin: sealtalk/sealtalk-android

@Override
public void onFinish() {
  if (listener != null) {
    listener.onFinish();
  } else {
    NLog.e(TAG, "DownTimerListener 监听不能为空");
  }
  if (mCountDownTimer != null)mCountDownTimer.cancel();
}

代码示例来源:origin: Catrobat/Paintroid

@Override
public boolean handleUp(PointF coordinate) {
  highlightBoxWhenClickInBox(false);
  if (longClickPerformed) {
    return true;
  }
  if (longClickAllowed) {
    downTimer.cancel();
  }
  return super.handleUp(coordinate);
}

代码示例来源:origin: vitas/beaconloc

@Override
public void onDestroyView() {
  if (unbinder != null) {
    unbinder.unbind();
  }
  mTimer.cancel();
  super.onDestroyView();
}

代码示例来源:origin: BuildmLearn/BuildmLearn-Toolkit-Android

@Override
  public void onClick(View v) {
    Bundle arguments = new Bundle();
    arguments.putString(Intent.EXTRA_TEXT, "1");
    countDownTimer.cancel();
    Fragment frag = QuestionFragment.newInstance();
    frag.setArguments(arguments);
    getActivity().getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
    getActivity().getSupportFragmentManager().beginTransaction().replace(((ViewGroup) getView().getParent()).getId(), frag).addToBackStack(null).commit();
  }
});

相关文章