Issue
While trying to implement a spinner in a view for an alertDialog, Android Studio is returning the following error:
Cannot resolve symbol @string/categoryOptions
I am trying to populate a spinner class:
<Spinner
android:id="@+id/category"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:entries="@string/categoryOptions"
/>
Using the following string array in res/values/strings.xml:
<resources>
<string-array name="categoryOptions">
<item>Stream or Lake</item>
<item>Well</item>
<item>Gov. Facility</item>
<item>Spring</item>
</string-array>
...
</resources>
I can access other plain string objects in the strings resource file, but not the string-array. It's completely possible that I have a syntax error somewhere and just am not seeing it, but I don't think that is the issue. Please help.
Solution
You should use
android:entries="@array/categoryOptions"
Answered By - Phien
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.