Android and RSSRecently, I was working on a simple Android application for an upcoming independent singer - the concept was simple, it was going to be an app with three different pages:
- Latest News - this was going to just be an RSS feed of the artists site to get all the latest info
- Watch Videos - this was going to be the artists youtube channel embeded
- Latest Tweets - this was going to be the artist's tweets (like any good upcoming artist they were making full use of social media channels)
Embedding youtube into android was going to be straight forward (both Google), and from my experience creating Zippy, my Twitter application, the tweets list was going to be easy, so the only work really was to create the RSS feed. Easy I thought..
A quick Google for Java RSS libraries threw up ROME - so I went about constructing all the necessary parts so ROME could plugin and feed me the info i needed to create a JSON list for my list view. However, on plugging it all together and trying to get ROME to work on my Android emulator it just wasn't playing nicely, so again back on Google and I found this discussion on StackOverflow - it turns out that ROME along with some other RSS parsers don't work on Android on account of incompatible packages on the Dalik JVM.
Being fairly frustrated at this point I decided to go back to basics and just implement my own RSS parser based on SAX - I found a tutorial here on a complete RSS parser Android application, so I was able to use some of that for the boiler plate stuff, but there were some issues with the parser not working correctly (not correctly handling the "characters" values in endElement()) but I have managed to get it working and creating a simple Android RSS reader - you can get the complete code here: (also on my source code example list to the left)
The code is an Eclipse project, you can just import this into your workspace and (as long as Android is correctly set up) run the application and you will see a simple RSS stream from my blog!