gpt4 book ai didi

android - 来自textview的定时器长时间

转载 作者:太空狗 更新时间:2023-10-29 16:26:23 27 4
gpt4 key购买 nike

myTimer = new Timer();
myTimer.schedule(new TimerTask() {
@Override
public void run() {
}, 0, 3000);

我需要更改 3000 计时器周期以从 TextView getText() 方法中获取值。

谢谢

最佳答案

As per doc : The third parameter is type long. And from textview you will get string. so you need to convert it to type long.

For more about timer

尝试:

long num = Long.parseLong(textView.getText().toString());

myTimer = new Timer();
myTimer.schedule(new TimerTask() {
@Override
public void run() {
}, 0, num);

关于android - 来自textview的定时器长时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51063261/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com