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);
精彩评论