抱歉,如果这是一个简单的问题,但我最近才开始学习编码,最终目标是为自己制作一个简单的维护清单应用程序。
我试图包含可以从主屏幕应用程序调用的零件号列表。我已使用 Microsoft Access 将原始列表从 excel 文件转换为 xml 文件,因为我一直在阅读它是 Android 中的首选文件格式。我正在尝试使用此网站上找到的大部分代码( http://p-xr.com/android-tutorial-how-to-parseread-xml-data-into-android-listview/ ),但我正在尝试利用我的 xml 文件已经添加到 R.raw 而不是从 http 中拉取它。
我假设我必须用 InputStream 命令替换 getxml 订单,但我不确定如何替换?
Sorry if this is a simple question, but I've only recently started learn coding with the end goal of making myself a simple maintenance checklist app for myself.
I'm trying to include a list of part numbers I can call from the main screen app. I have converted the original list from an excel file to an xml file using Microsoft Access, because I keep reading it's a preferred file format in Android. I’m trying to use most of the code found on this site ( http://p-xr.com/android-tutorial-how-to-parseread-xml-data-into-android-listview/ ), but I’m trying to utilize the xml file that I’ve already added to R.raw instead of pulling it in from an http.
I’m assuming I have to replace the getxml order with an InputStream command, but I'm not sure how ?
发布评论
评论(2)
使用 getResources().getXML(resourceid)
use getResources().getXML(resourceid)
试试这个。
第 1 步:获取要显示的项目列表的 xml(完成)
步骤 2:使用 SAX 等 XML 解析器解析 xml,并将其转换为 Map/List
步骤 3:将此地图/列表添加到列表视图的简单适配器中。
如果你愿意,我也可以分享代码。
Try this .
Step 1 : get xml which list of item to be displayed (Done)
Step 2 : Parse xml via use of XML parser like SAX and convert it into Map/List
Step 3 : Add this Map/List to Simple Adapter of your list View .
I can also share code if u want .