轻量计时器Android [英] light Weight Timer Android

查看:96
本文介绍了轻量计时器Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中将此计时器用作后台服务,因此我需要在特定条件下停止线程

这是我的代码:

Am using this timer as background service in my app,i need to stop the thread in certain condition

here is my code:

public void onDestroy(){
if (tmrBlink!= null) {			
tmrBlink.stop();
}


并在计时器类中也添加了条件,就像这样


And added if condition also in timer class,Like this

public void run() {
if (_tickHandler == null)
	return;
     _tickHandler.run();
 if(ticking){
  handler.postDelayed(delegate, _interval);
 }
}


但是停止线程是行不通的. . . .

在此先感谢..


But stopping the thread doesn''t work. . . .

Thanks in Advance..

推荐答案

http://steve.odyfamily .com/?p = 12 [ ^ ]
Android的轻量级计时器(后台工作者) [ ^ ]
http://steve.odyfamily.com/?p=12[^]
Light-weight Timer for Android (background worker)[^]


这篇关于轻量计时器Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆