Android - How to get Uri from raw file?

前端 未结 4 905
我寻月下人不归
我寻月下人不归 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:47

    Try this:

    uri = Uri.parse(
                    ContentResolver.SCHEME_ANDROID_RESOURCE
                            + File.pathSeparator + File.separator + File.separator
                            + context.getPackageName()
                            + File.separator
                            + R.raw.myrawname
            );
    

提交回复
热议问题