开发者

Android raw resource can't be found

I'm using a raw resource by creating a folder res/raw/myfile and then using the code InputStream is = Resources.getSystem().openRawResource(R.raw.myfile);

This code throws a resource not found exception and in the logs i开发者_Python百科t says "resources don't contain package for resource number 0x7f04000"

The code I used above is by my guess the correct one. All the other examples I've seen are not possible (2.1 sdk) as they may be old examples.

I've cleaned and built and used a fresh avd. My R.java looks like this public static final class raw { public static final int myfile=0x7f040000; }


Try this way.

  InputStream is = getResources().openRawResource(R.raw.myfile);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜