阅读Android的XML文件 [英] Read XML file in android

查看:109
本文介绍了阅读Android的XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个XML文件,其中包含我想读取数据。在code工作在一个桌面环境,但我无法弄清楚如何存储和从Android设备读取文件。想法?

I have an xml-file that contains data that I want to read. The code works in a desktop environment but I can't figure out how to store and read the file from an android device. Ideas?

推荐答案

把XML文件中的资源文件夹,并使用AssetManager获取它: http://developer.android.com/reference/android/content/res /AssetManager.html

Put the xml file in the assets folder and fetch it using the AssetManager: http://developer.android.com/reference/android/content/res/AssetManager.html

要读取的文件使用相同的Java code,关于J2SE为你工作。

To read the file use the same java code that works for you on J2SE.

这篇关于阅读Android的XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆