问题
I have the following code segments in my program:
ArrayAdapter<CharSequence> dataAdapter = ArrayAdapter.createFromResource(
this, R.array.datatypes, android.R.layout.simple_spinner_item);
ArrayAdapter<CharSequence> timeAdapter = ArrayAdapter.createFromResource(
this, R.array.timetypes, android.R.layout.simple_spinner_item);
I am getting an error on "R.array" indicating that array cannot be resolved or is not a field.
This was working moments ago and I am unsure what I have this.
I have tried including "com.throughputconverter.R" and cleaning and rebuilding multiple times. I have also restarted eclipse.
Any help would be appreciated.
Thanks
回答1:
Error using eclipse for Android - No resource found that matches the given name
Solved the problem I was having
回答2:
another solution here is to create the R manually..just hover to your error in the activity file where the problem was..and then manually create it...and R will generate the string array you created in strings.xml
来源:https://stackoverflow.com/questions/9252098/android-array-cannot-be-resolved-or-is-not-a-field