bharathi
bharathi

Reputation: 6271

Fetching news in android

I want to fetch news from web in android. I searched for some sample example in google but I am not able to find any source code.

Can any one explain the logic beyond the fetching news in android?

Upvotes: 1

Views: 644

Answers (3)

Octavian Helm
Octavian Helm

Reputation: 39604

It depends on what you want to query for. Is it a RSS response or is it a JSON response.

In theory you have to do the following. You have to send of a request to your request URL and parse the response be it XML (RSS is XML) or JSON. All that request and parsing stuff is to be done in a background thread so you don't block the main application thread (UI thread or service main thread).

Once you have parsed the data (preferably to objects) you will have to display it as you wish. Depending on your application you might have to persist the data in a SQLite database.

That was a very rough description of what you need to do in principle.

Upvotes: 1

fludent
fludent

Reputation: 364

IBM host a plethora of good tutorials.

This tutorial explains everything quite well and provides source: http://www.ibm.com/developerworks/xml/tutorials/x-androidrss/index.html

Upvotes: 0

Mascarpone
Mascarpone

Reputation: 2556

You need to setup an Http connection, using HttpClient, retrive the HTML, and parse it.

Upvotes: 0

Related Questions