Android - How to get Uri from raw file?

前端 未结 4 909
我寻月下人不归
我寻月下人不归 2020-12-03 11:58

I am trying to get the Uri from a raw file I have included in the project in the raw folder. But I am getting a FileNotFoundException,

4条回答
  •  囚心锁ツ
    2020-12-03 12:56

    You can open your InputStream to the raw Resource like this:

    InputStream rawInputStream = getResources().openRawResource(R.raw.usa_for_africa_we_are_the_world)
    DataInputStream dataInputStream = new DataInputStream(rawInputStream);
    

提交回复
热议问题