close
不能在onCreate的地方
使用TextView.setText(555)這種數字input , 否則會產生error
注意事項
1. setContentView 須放在setText前面!!!
2. TextView.setText( ) 括弧裡面放數字是"不合法"的 !! 參見andorid API
public final void setText (int resid)
↑此乃對應之R檔紀錄對應之記憶體位置 .. 所以放入數字常數是錯誤的用法 .. 除非自行定義array
Ex
final int [] MyAddress = {
R.string.home , R.string.page , ... , R.string.done
};
這樣使用時可以用TextView.setText(MyAddress[returnAddress]); 來得到對應的string address,其形態為"String"
謹記TextView.setText(" the word ") .. 設定時一定要注意Type是String !!!!
為了找出這個錯誤 .. 花了大約一個小時up在debug ... 細節是相當重要的,要多留意
全站熱搜