Two month ago I have talked about YoutubeParser, an Android Library that I developed. Today I want to talk about RSS-Parser, another library that I wrote.
This library allows you to easily download an (or multiple) RSS Feed in order to display it in your application. For every article it is possible to download the following information:
- Main Image
- Publication Date
Here you can find an example of feed.
The source code of the library is on Github together with a sample application that shows what you can do with the library.
- Click here to view the library on Github
- Click here to show the code of the sample app
- Click here to download the app
Of course the library is available also on jCenter so you can easily add the dependency on Gradle.
Now, let’s give a look on how it works. First on all you need to create a new Parser object and next you can execute the Parser by calling the method execute(), that requires as parameter the URL of the RSS feed.
If the data are correctly retrieved you can handle them inside the OnTaskCompleted method. Here you have an ArrayList of Article and you can use it for example to populate a Recycler View. Instead if some bad things happened, you can take actions inside the onError method.
That’s all! Please let me know if you notice any bug or if you have any advice that can improve this library.