如何获取android 下的StreamingAssets文件夹中的xml文件

如题所述

assets的读取方式:
1. 先在Activity里面调用getAssets() 来获取AssetManager引用。
2. 再用AssetManager的open(String fileName, int accessMode) 方法则指定读取的文件以及访问模式就能得到输入流InputStream。
3. 然后就是用已经open file 的inputStream读取文件,读取完成后记得inputStream.close() 。
4.调用AssetManager.close() 关闭AssetManager。
需要注意的是,来自Resources和Assets 中的文件只可以读取而不能进行写的操作
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答