简体   繁体   English

Android数组无法解析或不是字段

[英]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. 我在“ R.array”上收到一条错误消息,指示无法解析数组或该字段不是字段。

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. 我已经尝试过包括“ com.throughputconverter.R”以及多次清理和重建。 I have also restarted eclipse. 我还重新开始了Eclipse。

Any help would be appreciated. 任何帮助,将不胜感激。

Thanks 谢谢

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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