私の問題は、R.string.songの代わりにR.string。(変数)に変数を設定する方法です。私はこのR.string.nameを変数に変更する
TextView tv= (TextView) findViewById(R.id.textView);
tv.setText(R.string.song);
のように行う場合
string.xmlを
<string name="song">song title</string>
Javaコード
それが正常に動作しますが、私は、変数への参照名を変更した場合。 ..
String selectedsong = "song title";
TextView tv= (TextView) findViewById(R.id.textView);
tv.setText(R.string.selectedsong);
エラーが発生しました...その参照名を変数に変更することはできますか?私はこれで新しいです。おかげ
uは文字列が命名した:selectedsong? string.xmlをして<文字列名= "selectedsong">ここ –
selectedsong存在しません –