在Android开发中如何获取listview中的xml数据 [英] in android development how to fetch xml data in listview

查看:83
本文介绍了在Android开发中如何获取listview中的xml数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是android开发的新手,我现在进行了listview活动,我希望如果单击该listview中的任何内容,应从与其关联的链接中获取一些xml数据.所以请尽快帮助我真的很紧急.感谢

i am new in android development,i have made a listview activity now i want that if any thing from that listview is clicked should fetch some xml data from the link associated with it.so please help me as soon as possible,its really urgent. thanks

推荐答案

您必须按照以下步骤完成工作

步骤1您需要解析xml.参见 http://xmlpull.org/v1/src/java/samples/MyXmlPullApp.java [ ^ ]

步骤2为Category创建一个bean类.意味着所有与类别相关的数据都将存储在该bean类中.

步骤3创建该bean类的数组列表

步骤4使用该arraylist创建一个列表视图(该列表视图将仅显示类别名称)

步骤5在列表视图的itemclik侦听器上实施.获得职位.检索传递给意图调用第二个活动的数据

步骤6在第二个活动中创建一个列表视图,并显示第一个活动传递的所有数据
You have to follow the following steps to get your work done

Step-1 You need to parse the xml. see http://xmlpull.org/v1/src/java/samples/MyXmlPullApp.java[^]

Step-2 Create a bean class for Category. means all the category related data will be stored in that bean class

Step-3 Create an arraylist of that bean class

Step-4 Create a list view using that arraylist ( the list view will display only name of categories)

Step-5 Implement on itemclik listener on the list view. get the position. retrieve the data pass to the intent call second activity

Step-6 In the second activity create a listview and display the data whatever is passed by first activity


这篇关于在Android开发中如何获取listview中的xml数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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