Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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???

like image 245
BoltzmannBrain Avatar asked Aug 29 '14 16:08

BoltzmannBrain


1 Answers

@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!

like image 104
BoltzmannBrain Avatar answered Sep 22 '22 02:09

BoltzmannBrain