1

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.

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

Manoj Fegde
  • 4,786
  • 15
  • 50
  • 95
  • 1
    have a edit text to allow user to enter url. get the url from edittext and make a http request. get the response parse and display the same. – Raghunandan Mar 22 '13 at 08:42

2 Answers2

2

In general

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

For long running background operations use service.

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.

Making a soap request. http://www.youtube.com/watch?v=v9EowBVgwSo.

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?.

Make a http request and get the response.

http://www.androidhive.info/2011/10/android-making-http-requests/

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

If your respone is xml parse the xml file

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

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

Community
  • 1
  • 1
Raghunandan
  • 132,755
  • 26
  • 225
  • 256
0

Use Web services like JSON,SOAP

I prefer JSON

JSON

How to create a JSON response:

Android includes JSON classes such as JSONArray, JSONObject that can be used to interpret the response the Web Service will return. See more at: Link

Nirav Ranpara
  • 13,753
  • 3
  • 39
  • 54