• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps "Cannot resolve symbol 'array' " in R.array.array_name

Elereth

Lurker
Trying to populate a dropdown box via a Spinner. I have a <string-array name="currencies_array"> defined and populated in strings.xml. The array in R.array.currencies_array is highlighted red saying "cannot resolve symbol 'array' ". Exact code from android documentation itself and stackoverflow articles.

Android doc for spinner under "populate the spinner with user choices: https://developer.android.com/guide/topics/ui/controls/spinner#java
StackOverflow article (based on reply by Gurinder Singh, 3rd down): https://stackoverflow.com/questions/13377361/how-to-create-a-drop-down-list

Code:
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.currencies_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
dropdown.setAdapter(adapter);
 
Back
Top Bottom