Android openRawResource() not working for a drawable

后端 未结 3 398
终归单人心
终归单人心 2021-01-04 08:46

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

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

but I

3条回答
  •  执笔经年
    2021-01-04 09:28

    It is because They are expecting a raw type resource and you are passing a drawable type one. make a raw folder in the res folder and then put your image in the raw folder.

提交回复
热议问题