安卓openRawResource()不工作的绘制 [英] Android openRawResource() not working for a drawable

查看:1470
本文介绍了安卓openRawResource()不工作的绘制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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!

这篇关于安卓openRawResource()不工作的绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆