스피너 선택을 기반으로 선택하려는 XML 파일의 값 목록이 있습니다. 어떤 이유로 든 스피너에 배열 문자열을 사용하면 문제가 발생하지 않고 값이 스피너에 채워집니다. 어떤 이유로 든 제 인생을 구하기 위해 두 번째 배열의 값을 얻을 수 없습니다. 오류가없는 동일한 파일에 있습니다. (오류가이 부분을하지 않는 것)XML에서 배열 문자열 리소스를 가져올 수 없습니다.
String[] some_array = getResources().getStringArray(R.array.playerclassdesc_array);
스피너 다르게 채워집니다 :
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.playerclass_array, android.R.layout.simple_spinner_item);
내가 점점 오전 오류는 다음과 같습니다
"여기에 내가 그들을 잡으려고 노력하고있는 방법입니다 04:16 21 : 41 : 35.305 : 오류/AndroidRuntime (514) : 원인 : android.content.res.Resources $ NotFoundException : 문자열 배열 리소스 ID # 0x7f050001 "
직접"getResources " 선. 누군가 이런 일이 일어날 수있는 어떤 단서가 있습니까?
편집 : 여기에 XML 파일 난 직후 답을 찾을 때
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="class_prompt">Choose a class</string>
<string-array name="playerclass_array">
<item>Assassin</item>
<item>Paladin</item>
<item>Pirate</item>
<item>Hell Mage</item>
<item>Winter Witch</item>
<item>Shadow Walker</item>
<item>Underthief</item>
<item>Red Warrior</item>
<item>Haru Norda</item>
</string-array>
<string-array name="playerclassdesc_array">
<item>This is the Assassin</item>
<item>This is the Paladin</item>
<item>This is the Pirate</item>
<item>This is the Hell Mage</item>
<item>This is the Winter Witch</item>
<item>This is the Shadow Walker</item>
<item>This is the Underthief</item>
<item>This is the Red Warrior</item>
<item>This is the Haru Norda</item>
</string-array>
</resources>
답변으로 표시하여 필터링 할 수 있습니다. –
나는 기다려야한다. 분명히 자신의 질문에 답하는 데 2 일의 시간 제한이있다. 누군가가 같은 문제에 부딪 힐 경우를 대비해서 (질문) 떠날 것입니다. – Organiccat
"바로 대답을 찾으면 나는 싫어!" 같은 일이 적어도 3-4 번 나 일어났습니다 : p –