单击保存按钮时如何保存xml标记结果?

时间:2011-10-03 09:07:51

标签: android android-layout

大家好我有xml代码,如下所示

<root>
<key>
<Question>Is the color of the car</Question>
<Ans>black?</Ans>
</key>
<key>
<Question>Is the color of the car</Question>
<Ans>black?</Ans>
</key>
<key>
<Question>Is the news paper </Question>
<Ans>wallstreet?</Ans>
</key>
<key>
<Question>fragrance odor</Question>
<Ans>Lavendor?</Ans>
</key>
<key>
<Question>Is the baggage collector available</Question>
<Ans></Ans>
</key>
</root>

在屏幕上显示为:

列表表格 汽车的颜色是黑色的吗?复选框 行李收集器可用吗?复选框

如果选中复选框 - 是,否则vlaue为no。 在保存按钮上:我们需要将其保存到xml文件中

这里我在收到问题时会收到问题,但我的问题是如何在点击保存按钮后将检查列表项目保存到xml文件中,所以给我解决你们中的任何一个。

1 个答案:

答案 0 :(得分:1)

您可以参考http://www.ibm.com/developerworks/opensource/library/x-android/index.html中的[在Android上使用XML]中的[Creating XML]部分。生成XML后,可以在File和Stream类的帮助下将其保存到文件中。