【发布时间】:2013-10-27 16:38:29
【问题描述】:
你能告诉我这一行的问题出在哪里吗:timerText.setText(seconds);。
public class ShowTimer extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.timer_test_xml);
Timer myTimer = new Timer();
myTimer.schedule(new TimerTask() {
int seconds;
TextView timerText = (TextView) findViewById(R.id.TimerTestId);
@Override
public void run() {
seconds++;
timerText.setText(seconds);
}
}, 0, 1000);
}}
【问题讨论】:
-
android 上的
setText(int)函数没有文档,所以我真的不知道它是做什么的。你确定它是你要调用的函数吗? -
如果我们把一个字符串作为方法的参数还是不行:)
-
您希望发生什么以及实际发生了什么?