Message message = new Message();
Timer timer = new Timer();
Handler handler = new Handler()
{
public void handleMessage(Message msg)
{
switch (msg.what)
{
case 1:
TimerTick(); // 出口
break;
}
super.handleMessage(msg);
}
};
TimerTask task = new TimerTask()
{
public void run()
{
message = new Message();
message.what = 1;
handler.sendMessage(message);
}
};
Android Timer计时器简单写法
最新推荐文章于 2024-06-24 08:45:00 发布