我有一个小问题。
new CountDownTimer(12000, 2000) {
public void onTick(long millisUntilFinished) {
}
public void onFinish() {
}
}.start();
在此,我希望setText
与每个TextView
的6个不同的onTick()
(在一个xml中)。我有什么想法可以做到这一点?感谢
//修改
I would like have something like this
First tick
tv.setText("one")
Second Tick
tv2.setText("two")
答案 0 :(得分:4)
尝试使用像
这样的TextViews数组TextView[] textViews = new TextView[6];
String[] value = new String[]{"one","two","three","four","five","six"};
int count = 0;
new CountDownTimer(12000, 2000) {
public void onTick(long millisUntilFinished) {
textViews[count].setText(value[count]);// you can set dynamic string variable also
count++;
}
public void onFinish() {
}
}.start();
答案 1 :(得分:1)
你可以这样做:
self.wfile.write(b"<foo>bar</foo>")
答案 2 :(得分:0)
检查以下答案,
new CountDownTimer(12000, 2000) {
public void onTick(long millisUntilFinished) {
Activity_Name.this.runOnUiThread(new Runnable() {
@Override
public void run() {
tv1.setText("");
tv2.setText("");
tv3.setText("");
tv4.setText("");
}
});
}
public void onFinish() {
}
}.start();