我怎样才能在这里更改文本视图文本
How can I change textview text here
斐波那契数列程序,点击按钮给出下一个数字。我希望 TextView 给出相加数字的值 (ax)。
public void next(View v) {
TextView ax = new TextView(this); //new
Button next = (Button) findViewById(R.id.next);
z = x + y;
next.setText(String.valueOf(z));
ax.setText(x); //new
x = y;
y = z;
}
添加"new"行后,点击按钮程序强制关闭。
简单错误
ax.setText(String.valueOf(x));
斐波那契数列程序,点击按钮给出下一个数字。我希望 TextView 给出相加数字的值 (ax)。
public void next(View v) {
TextView ax = new TextView(this); //new
Button next = (Button) findViewById(R.id.next);
z = x + y;
next.setText(String.valueOf(z));
ax.setText(x); //new
x = y;
y = z;
}
添加"new"行后,点击按钮程序强制关闭。
简单错误
ax.setText(String.valueOf(x));