我的启动画面有这个代码
<!DOCTYPE html><html><body>
<a href="http://example.org"target="_blank"title="This is a test">Yabba Dabba Doo!</a>
</body></html>
是否可以从run(){}中获取 TIMEOUT_TIME 的当前时间?
答案 0 :(得分:0)
AFAIK,Handler没有提供任何方便的方法来执行此操作。您必须保存初始时间并计算已用时间。与this一样。
答案 1 :(得分:0)
使用此功能,您将在超时时获得当前时间。
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
String currentDateandTime = sdf.format(new Date());
Log.e("Demo","==================================="+currentDateandTime);
}
}, 3000);
答案 2 :(得分:0)
更确切地说,我会使用nanoTime()方法而不是currentTimeMillis():
long startTime = System.nanoTime();
myCall();
long stopTime = System.nanoTime();
System.out.println(stopTime - startTime);