Show feeds in android
I want to show开发者_开发知识库 feeds from a blog in a listview. It would be really help if you guys can suggest some tutorials or how to do it?
thanks in adv.
I can point you in the right direction, using standard Android SDK components.
Your solution will consist of several pieces - an HTTP downloader, an RSS parser (presumably the blogs have public RSS feeds), a ListAdaptor
, and your ListView
.
- Firstly, you need to grab the RSS file from the blog. There are a bunch of ways to do this, I'd suggest using
HttpClient
andHttpGet
. - Next, you'll need to parse the RSS file you downloaded. For this, you can use
XMLReader
. Writing a good RSS parser is probably the trickiest bit! - Now you've got your data parsed, store it in a list and write a
ListAdaptor
. - Hook the
ListAdaptor
upto yourListView
usingsetAdaptor
and you're good to go.
If this all sounds a bit complicated, there are various Java RSS libraries that'll perform steps 1 and 2 for you.
You may also want to take a look at the source code of android-rss, and give IBM's XML article a good read!
精彩评论