Android RSS Reader Tutorial

In this android rss reader tutorial we will see how to make demo app that can read rss of a website or blog. So without wasting much time lets begin.

Typically the rss feed of a website or blog look something like shown below.

The data we get is in xml format.

Here channel tag is the root or the main element from where rss begins.

title shows the name of the website.

description tells the content of website.

link is the url to the website.

There are multiple item tags that contain article or post information like post title, link, publish date, etc.

First of all create a new android project to read the rss in android app.

Then we need to give internet permission in manifest to access the rss in application.

Now we are adding some of the dependency that we need in our project.

We are designing our activity_main.xml file.

activity_main.xml

Here we are using swipe refresh layout just to refresh the rss content of a website.

Now we have to code MainActivity.java for building our functionality of application so first we have to reference xml components in java.

We have to define a java class called FetchFeedTask which is used to get the rss feed from url.

Now we are defining a list and parsing xml data to get the attribute of items from the rss feed we have extracted.

Defining RssModel java class which we used to hold the attribute of every post.

Defining RecyclerAdapter to attach our list data to recyclerview.

Finally the MainActivity.java file will look like.

MainActivity.java

We have to define the layout used in every recyclerview post.

recycler_layout.xml

Atlast we have to use our adapter in our onPostExecute method to distribute our list in recyclerAdapter.

We have defined another activity which is called when we click on anycard of recyclerView which opens full content of a post in webView.

activity_final.xml file

And we have to define its java class too.

Final.java

Android RSS Reader Tutorial

That’s all, now you can run your app in your physical device or in your emulator and see your rss feed in list format.

Comment below if you have any queries related to above android rss reader example.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.