机器人 - 测量betweeen两个按钮点击时间 [英] android - To measure the time betweeen the two button clicks

查看:177
本文介绍了机器人 - 测量betweeen两个按钮点击时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个按钮和一个名为检查In.My的目标是点击,更改文本,并开始计数time.the计时器已停止,直到下一个click.It应该给它两粒扣点击之间所花费的时间。

I have a button named Check In.My aim is on click,change the text and start counting the time.the timer has to stop until the next click.It should give the time it taken between two button clicks.

推荐答案

在第一次点击创建一个变量:

On the first click create a variable:

long startTime = System.currentTimeMillis();

然后在第二次点击就可以计算出不同的:

Then on the second click you can calculate the difference:

long difference = System.currentTimeMillis() - startTime;

差/ 1000 会给你在几秒钟的差异。希望这有助于。

difference / 1000 will give you the difference in seconds. Hope this helps.

这篇关于机器人 - 测量betweeen两个按钮点击时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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