Android array cannot be resolved or is not a field

给你一囗甜甜゛ 提交于 2019-12-08 12:45:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!