安卓:从服务器获取数据 [英] Android: Get data from server

查看:307
本文介绍了安卓:从服务器获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要开发的应用程序。在哪个用户在运行时输入的URL。 XML是放在服务器上。因此,如何击中或获取XML的数据,这样我可以解析数据并使用它。我知道解析。但如何直接获取数据,我不知道。

I want to develop an application. In which user enter a URL at run time. The XML is placed on server. So how to hit or get the data of that XML, so that i can parse the data and use that. The parsing i know. But how to get data directly i dont know.

所以,请建议我如何打网址,并得到了与Web服务的数据。

So please suggest me how to hit url and get data with out web service.

推荐答案

在一般

要对服务器的请求,你可以使用AsyncTask的或服务。

To make a request to the server, you can use a Asynctask or service.

有关长时间运行的后台操作使用的服务。

For long running background operations use service.

要AsyncTask的另一种方法是Robospice。 <一href=\"https://www.google.co.in/search?q=robospice&oq=robospice&aqs=chrome.0.57j59l2j60j62l2.2501&sourceid=chrome&ie=UTF-8\" rel=\"nofollow\">https://www.google.co.in/search?q=robospice&oq=robospice&aqs=chrome.0.57j59l2j60j62l2.2501&sourceid=chrome&ie=UTF-8.

An alternative to Asynctask is Robospice. https://www.google.co.in/search?q=robospice&oq=robospice&aqs=chrome.0.57j59l2j60j62l2.2501&sourceid=chrome&ie=UTF-8.

将SOAP请求。
http://www.youtube.com/watch?v=v9EowBVgwSo

样code。与屏幕截图在<一个href=\"http://stackoverflow.com/questions/15521740/to-use-the-tutorial-in-android-4-0-3-if-had-to-work-with-asynxtasc-but-i-still-d/15521935#comment22060397_15521935\">To使用教程安卓4.0.3如果曾与AsynxTasc工作,但我仍然不工作?。

Sample code with screen shot at To use the tutorial in android 4.0.3 if had to work with AsynxTasc but i still dont work?.

请一个http请求并得到响应。

Make a http request and get the response.

http://www.androidhive.info/2011/10 / Android的决策-HTTP-请求/

http://www.vogella.com/articles/AndroidNetworking/article.html

如果您输入反应是XML解析xml文件

If your respone is xml parse the xml file

HTTP:// WWW .mkyong.com / JAVA /如何阅读的XML文件,在Java的DOM解析器/ 。解析使用的DOMParser。

http://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/. Parse using domparser.

HTTP:// WWW .mkyong.com / JAVA /如何阅读的XML文件,在Java的萨克斯解析器/ 。解析使用SAX解析器。

http://www.mkyong.com/java/how-to-read-xml-file-in-java-sax-parser/. Parse using sax parser.

这篇关于安卓:从服务器获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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