How to read local xml file is resource folder as a input stream in android?

好久不见. 提交于 2019-11-30 10:16:57

Put the xml file into /res/raw folder. It looks like openRawResource opens resources from that folder only. You can also try getResources().getXml(com.MYCLass.R.xml.programs); which will return you an instance of XML parser.

A piece of code taken from @Krupa

InputStream object = this.getResources()
                     .openRawResource(R.raw.fileName);
Krupa

You can read the file by the following code :

InputStream object = this.getResources()
        .openRawResource(R.rawFolderName.fileName);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!