-1
串什麼,我已經學會爲止:Android的填充陣列從string.xml
在strings.xml中我有一堆
<string name="q1">what is the name of blah blah</string>
<string name="q2">what is the name of blah blah</string>
<string name="q3">what is the name of blah blah</string>
<string name="q4">what is the name of blah blah</string>
,並在主類我要創建數組問題對象來訪問它們 整個主類像
private Question[] mQuestionList = new Question[]{
new Question(R.string.q1, true),
new Question(R.string.q2, false),
new Question(R.string.q3, true),
new ...
}
什麼IM好奇的是,如果我有200個問題,我知道我有stirng他們每個人寫出來的。 xml文件,但是我認爲在主類中200「新問題(R.string.qx,true/false)」語句不是正確的方法。我相信有更多簡單的方法來填充mQuestionList數組。如果有什麼?