简体   繁体   中英

Android array cannot be resolved or is not a field

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

这里的另一种解决方案是手动创建R。只需将鼠标悬停在问题所在的活动文件中,然后手动创建R,然后R就会生成您在strings.xml中创建的字符串数组

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM