0
我想要做的是將TextView的文本更改爲整數的文本,以便在顯示時頁面將顯示數字。將TextView更改爲Int值
目前,TextView表示「VALUEFROMfirstResult」。我想把它改成firstResult的整數,例如如果生成的整數是23,那麼TextView將會說23而不是前面提到的。
public class Second extends Activity{
TextView reslt;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.second);
}
public static void insert(int firstResult2) {
// TODO Auto-generated method stub
reslt = (TextView) findViewById(R.id.tvResult);
我該怎麼做?
我認爲這個指令將在內存中創建3串 「」,firstResult2的rappresentation作爲字符串和串聯。所以我的解決方案好一點,因爲在內存中創建只有一個字符串 – StErMi 2012-01-08 16:44:29
工作就像一個魅力!它不允許非靜態插入靜態,所以我改變了「TextView reslt;」到「靜態TextView reslt;」 – MiKenning 2012-01-08 19:10:22
也想想StErMi,只是想增加另一個選項。 – Dante 2012-01-08 22:42:35