安卓openRawResource()不工作的绘制工作、openRawResource

2023-09-06 03:34:53 作者:高傲得不顧一屑

我想通过这样做是为了创建一个输入流

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

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

但我遇到了错误式的原始预期的资源相对于我的绘制文件(R.drawable.image1)。此搜索是一个png,在我RES /绘制文件夹。

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.

任何想法???

推荐答案

@Broatian我目前还没有一个RES /原始文件夹中。我找到了一个替代的解决方案: 是= context.getResources()openRawResource(+ R.drawable.image1); + 显示其他文件夹。感谢您的帮助!

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