Android openRawResource() not working for a drawable


I'm trying to create an input stream by doing this

InputStream is = (InputStream) getResources().openRawResource(R.drawable.image1);

but I'm met with the error "Expected resource of type raw" with respect to my drawable file (R.drawable.image1). image1 is a png and in my res/drawable folder.

Any ideas???

Best Solution

@Broatian I don't currently have a res/raw folder. I found an alternative solution: is = context.getResources().openRawResource(+ R.drawable.image1); The + shows additional folders. Thanks for the help!