How to get rss feeds android?

前端 未结 3 1882
予麋鹿
予麋鹿 2020-12-05 21:51

I have this url here: http://www.webpronews.com/feeds

Now i need to get the feeds and display it in android. Any clue?

3条回答
  •  情深已故
    2020-12-05 22:10

    DavLink, is right. RSS parsing is not trivial.

    It's fairly easy to setup an implementation of a SAX parser but the hard part is to be able to parse any and every feed under the sun.

    You need to cater to all formats RSS 1, RSS 2, Atom etc. Even then you will have to contend with poorly formatted feeds.

    I had faced similar problems in the past so decided to do my feed parsing on a server and just get the parsed contents. This allows me to run more complex libraries and parser which I can modify without pushing out updates for my app.

    I have the following service running on AppEngine which allows for a much simpler XML / JSON parsing at your end. There is a fixed and simple structure to the response. You can use this for parsing

    http://evecal.appspot.com/feedParser

    You can send both POST and GET requests with the following parameters.

    feedLink : The URL of the RSS feed response : JSON or XML as the response format

    Examples:

    For a POST request

    curl --data-urlencode "feedLink=http://feeds.bbci.co.uk/news/world/rss.xml" --data-urlencode "response=json" http://evecal.appspot.com/feedParser

    For GET request

    evecal.appspot.com/feedParser?feedLink=http://feeds.nytimes.com/nyt/rss/HomePage&response=xml

    My android app "NewsSpeak" uses this too.

    After you get your information, you can use a simple listview with an arrayadapter having your array of items.

提交回复
热议问题