我需要访问原始资源中的文件,我正在尝试获取Uri
,然后在FileInputStream中使用它,但我收到:
10-17 22:51:47.338:W / System.err(5619):java.io.FileNotFoundException: / raw / help_content(没有这样的文件或目录)
这是我创建Uri
:
Uri rawHelpZip = Uri.parse("android.resource://"
+ context.getPackageName() + "/raw/help_content");
我也试过这个:
Uri rawHelpZip = Uri.parse("android.resource://"
+ context.getPackageName() + "/"+R.raw.help_content);
注意:help_content是一个zip文件,这与我的问题有关吗?
答案 0 :(得分:3)
这样做,使用方法
中构建的上下文更清晰InputStream is = context.getResources().openRawResource(R.raw.help_content);
// Do something with the InputStrem