usa*_*don 0 xml android gzip filenotfoundexception
所以,我正在尝试这个教程:http: //xjaphx.wordpress.com/2011/12/24/android-xml-adventure-parsing-xml-using-xpath/ 它工作得很好.我试图更改代码以适用于gzip压缩文件:
InputStream is = getResources().openRawResource(R.raw.data);
GZIPInputStream gz = new GZIPInputStream(is);
InputSource inputSrc = new InputSource(gz);
Run Code Online (Sandbox Code Playgroud)
但第一行抛出"java.io.FileNotFoundException:res/raw/data.xml.gz".我还尝试清理项目并将文件放在资产文件夹中并使用资产管理器打开它,但似乎没有任何工作.
摆脱文件的扩展名.将它重命名为类似的东西data_xml_gz
并像这样引用:
InputStream is = getResources().openRawResource(R.raw.data_xml_gz);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
442 次 |
最近记录: |