本文介绍了R.raw.anything不能得到解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android应用程序与Eclipse。

I'm developing an android apps with Eclipse.

在我的应用程序,我尝试读取文件:data.xml中。我把它放在RES /生/,并访问我应该使用getRessources()openRawResource(R.raw.data);

In my app, I try to read a file : data.xml. I put it in res/raw/, and to access it i'm supposed to use getRessources().openRawResource(R.raw.data);

但是Eclipse告诉我一个错误:数据不能得到解决,或者不是一个领域

But Eclipse show me an error : "data" cannot be resolved or is not a field.

但现场是在GEN / R.java!

But the field is in the gen/R.java !!!

public final class R {
    public static final class raw {
            public static final int data=0x7f040000;
     }
}

任何想法?谢谢

Any ideas ?Thanks

解决方案:进口权R.java文件!     进口my_package.R;

Solution : Import the right R.java files ! import my_package.R;

停止信任CTRL + SHIFT + O ...

Stop trusting ctrl+shift+O ...

推荐答案

我已经有几个星期前,面对这个问题。您只需使用 com.example.R (其中com.example是你的包的名称),因为Eclipse认为你正在使用安卓.R 默认情况下。尝试了这一点。

I already faced this problem several weeks ago. You simply have to use com.example.R (where com.example is the name of your package), because Eclipse thinks that you are using android.R by default.Try this out.

这篇关于R.raw.anything不能得到解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 19:14