我想要strings.xml文件中存在的字符串列表。獲取Android中的strings.xml文件中存在的字符串列表
有誰知道如何得到它?我發現的一件事是它在R.java內部按順序分配了id,但是如何獲得起始ID尚不清楚。
例如,我在下面的strings.xml中有100個字符串,我想一次讀入,而不是像給個別的getResource()。getString(int id)那樣讀入。
<string name="app_label">Calendar</string>
<string name="what_label">What</string>
<string name="where_label">Where</string>
<string name="when_label">When</string>
<string name="timezone_label">Time zone</string>
<string name="attendees_label">Guests</string>
<string name="today">Today</string>
<string name="tomorrow">Tomorrow</string>
你可以通過使用getResources.getString(「your_string_name」); –
我知道,但我想要所有字符串的列表,如果我使用這種方法我必須給所有字符串的ID說如果100字符串在那裏我必須寫這100次 –
請參閱我的答案在這裏http://stackoverflow.com/問題/ 13820645 /比較名稱的每個資源與一個變量的內容的SQLite數據庫/ 13821330#13821330 – Luksprog