【发布时间】:2015-11-22 15:15:51
【问题描述】:
Runnable r = new Runnable(){
public void run(){
try{
For (int i = 60; i >= 1; i--) {
System.out.print(i + "\r");
// Let the thread sleep for a while.
Thread.sleep(1000);
TextView box2 = (TextView) findViewById(R.id.box2);
box2.setText("\r" + i + " sec left");
}
} catch (InterruptedException e) {
}
}
如何使数字从 60 运行到 0 并在 android studio 的文本视图上打印,以及在 android studio 的文本视图中打印的正确方法是什么。谢谢您的帮助!
【问题讨论】:
-
使用 handler.postDelayed();带有可运行文件的方法。
-
非常感谢兄弟的帮助!
-
我还添加了一个答案来解释更多。
标签: java android printing numbers countdown