In this tutorial i am going to explain building simple rss reader application. If you are novice about RSS, please go through this RSS 2.0 Specification and get an idea about RSS.

Download Code

The Application Overview

The is very simple rss reader application. The complete application will have four views
1. A view will list all the websites (stored in SQLite table) in a listview
2. View to add new website to application.
3. On selecting single website from listview another listview will display list of articles for that particular website
4. Once the sinlge article is selected that web page will display on webview.
SQLite database is used to store websites entered by used.

So lets start by creating new project in Eclipse. Create a project and fill all the details.

1. Modifying the AndroidManifest.xml file

At first i am editing the AndroidManifest.xml file and adding required code like INTERNET Persmissions, new Activity class files. So open your manifest file and do following changes.

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.androidhive.rssreader"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:configChanges="keyboardHidden|orientation"
            android:name=".AndroidRSSReaderApplicationActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
        <!-- Add New Site Activity -->
        <activity android:name=".AddNewSiteActivity" />
        
        <!-- List rss items Activity -->
        <activity android:name=".ListRSSItemsActivity" 
            android:configChanges="keyboardHidden|orientation"/>
        
        <!-- Display webpage Activity -->
        <activity android:name=".DisPlayWebPageActivity"
            android:theme="@android:style/Theme.NoTitleBar"
            android:configChanges="keyboardHidden|orientation" />
    </application>
    
    <!-- Internet Permissions -->
    <uses-permission android:name="android.permission.INTERNET" />

</manifest>

2. Downloading Jsoup html parser library

In order to get rss links from html source code i used Jsoup java library. Download and add the jar file to your project Java Build Path library.

You can download the jar file by going to http://jsoup.org/download

Once downloaded Right Click on project -> properties -> Select Java Build Path (on left side) -> Select third tab Libraries (on right side) -> Add External Jar -> Browse to downloaded jsoup .jar file.

android adding jsoup reference .jar
android adding jsoup reference .jar

3. Preparing required class files

If you look at below rss xml structor, you can see it has basic website information like title, link, description and an array of item nodes where each item node indicates single article. Again each item node has child nodes like title, link, pubDate and description. After parsing rss xml i prefer to maintain xml nodes into object. So create following class file in your project

<channel>
	<title></title>
	<link></link>
	<description></description>
	<item>
		<title></title>
		<link></link>
		<pubDate></pubDate>
		<description></description>
	</item>
	<item>
	.
	.
	.</item>
</channel>

Create a class file called RSSFeed.java and type the following code. This class file used to create an object for rss feed which handles website basic information like title, description, link, rss link, language and an array of rss items.

RSSFeed.java

package com.androidhive.rssreader;

import java.util.List;

/**
 * This class handle rss xml 
 * */
public class RSSFeed {
	// xml nodes
	String _title;
	String _description;
	String _link;
	String _rss_link;
	String _language;
	List<RSSItem> _items;

	// constructor
	public RSSFeed(String title, String description, String link,
			String rss_link, String language) {
		this._title = title;
		this._description = description;
		this._link = link;
		this._rss_link = rss_link;
		this._language = language;
	}

	/**
	 * All set methods
	 * */
	public void setItems(List<RSSItem> items) {
		this._items = items;
	}

	/**
	 * All get methods
	 * */
	public List<RSSItem> getItems() {
		return this._items;
	}

	public String getTitle() {
		return this._title;
	}

	public String getDescription() {
		return this._description;
	}

	public String getLink() {
		return this._link;
	}

	public String getRSSLink() {
		return this._rss_link;
	}

	public String getLanguage() {
		return this._language;
	}
}

Also create another class file called RSSItem.java which handles individual article information like title, link, pubDate and description.

RSSItem.java

package com.androidhive.rssreader;

/**
 * This class handle RSS Item <item> node in rss xml
 * */
public class RSSItem {
	
	// All <item> node name
	String _title;
	String _link;
	String _description;
	String _pubdate;
	String _guid;
	
	// constructor
	public RSSItem(){
		
	}
	
	// constructor with parameters
	public RSSItem(String title, String link, String description, String pubdate, String guid){
		this._title = title;
		this._link = link;
		this._description = description;
		this._pubdate = pubdate;
		this._guid = guid;
	}
	
	/**
	 * All SET methods
	 * */
	public void setTitle(String title){
		this._title = title;
	}
	
	public void setLink(String link){
		this._link = link;
	}
	
	public void setDescription(String description){
		this._description = description;
	}
	
	public void setPubdate(String pubDate){
		this._pubdate = pubDate;
	}
	
	
	public void setGuid(String guid){
		this._guid = guid;
	}
	
	/**
	 * All GET methods
	 * */
	public String getTitle(){
		return this._title;
	}
	
	public String getLink(){
		return this._link;
	}
	
	public String getDescription(){
		return this._description;
	}
	
	public String getPubdate(){
		return this._pubdate;
	}
	
	public String getGuid(){
		return this._guid;
	}
}

Now create a class file called Website.java which is used to handle SQLite database opoerations. This class will create an object for SQLite table single row.

Website.java

package com.androidhive.rssreader;


/**
 * This class file used while inserting data or retrieving data from 
 * SQLite database
 * **/
public class WebSite {
	Integer _id;
	String _title;
	String _link;
	String _rss_link;
	String _description;
	
	// constructor
	public WebSite(){
		
	}

	// constructor with parameters
	public WebSite(String title, String link, String rss_link, String description){
		this._title = title;
		this._link = link;
		this._rss_link = rss_link;
		this._description = description;
	}
	
	/**
	 * All set methods
	 * */
	public void setId(Integer id){
		this._id = id;
	}
	
	public void setTitle(String title){
		this._title = title;
	}
	
	public void setLink(String link){
		this._link = link;
	}
	
	public void setRSSLink(String rss_link){
		this._rss_link = rss_link;
	}
	
	public void setDescription(String description){
		this._description = description;
	}
	
	/**
	 * All get methods
	 * */
	public Integer getId(){
		return this._id;
	}
	
	public String getTitle(){
		return this._title;
	}
	
	public String getLink(){
		return this._link;
	}
	
	public String getRSSLink(){
		return this._rss_link;
	}
	
	public String getDescription(){
		return this._description;
	}
}

4. Writing RSS Parser Class

The main purpose of RSS Parser class is to parse the rss xml and return RSSFeed object. When user enters a website url this class will do following tasks

-> Will get the html source code of the website
-> Parse the html source code and will get rss url
-> After getting rss url will get rss xml and parse the xml.
-> Once rss xml parsing is done will return RSSFeed object of the rss xml.

In your project folder create a class file called RSSParser.java and paste the following code.

RSSParser.java

package com.androidhive.rssreader;

import java.io.IOException;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.jsoup.Jsoup;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import android.util.Log;

public class RSSParser {

	// RSS XML document CHANNEL tag
	private static String TAG_CHANNEL = "channel";
	private static String TAG_TITLE = "title";
	private static String TAG_LINK = "link";
	private static String TAG_DESRIPTION = "description";
	private static String TAG_LANGUAGE = "language";
	private static String TAG_ITEM = "item";
	private static String TAG_PUB_DATE = "pubDate";
	private static String TAG_GUID = "guid";

	// constructor
	public RSSParser() {

	}

	/***
	 * Get RSS feed from url
	 * 
	 * @param url - is url of the website 
	 * @return RSSFeed class object
	 */
	public RSSFeed getRSSFeed(String url) {
		RSSFeed rssFeed = null;
		String rss_feed_xml = null;
		
		// getting rss link from html source code
		String rss_url = this.getRSSLinkFromURL(url);
		
		// check if rss_link is found or not
		if (rss_url != null) {
			// RSS url found
			// get RSS XML from rss ulr
			rss_feed_xml = this.getXmlFromUrl(rss_url);
			// check if RSS XML fetched or not
			if (rss_feed_xml != null) {
				// successfully fetched rss xml
				// parse the xml
				try {
					Document doc = this.getDomElement(rss_feed_xml);
					NodeList nodeList = doc.getElementsByTagName(TAG_CHANNEL);
					Element e = (Element) nodeList.item(0);
					
					// RSS nodes
					String title = this.getValue(e, TAG_TITLE);
					String link = this.getValue(e, TAG_LINK);
					String description = this.getValue(e, TAG_DESRIPTION);
					String language = this.getValue(e, TAG_LANGUAGE);

					// Creating new RSS Feed
					rssFeed = new RSSFeed(title, description, link, rss_url, language);
				} catch (Exception e) {
					// Check log for errors
					e.printStackTrace();
				}

			} else {
				// failed to fetch rss xml
			}
		} else {
			// no RSS url found
		}
		return rssFeed;
	}

	/**
	 * Getting RSS feed items <item>
	 * 
	 * @param - rss link url of the website
	 * @return - List of RSSItem class objects
	 * */
	public List<RSSItem> getRSSFeedItems(String rss_url){
		List<RSSItem> itemsList = new ArrayList<RSSItem>();
		String rss_feed_xml;
		
		// get RSS XML from rss url
		rss_feed_xml = this.getXmlFromUrl(rss_url);
		
		// check if RSS XML fetched or not
		if(rss_feed_xml != null){
			// successfully fetched rss xml
			// parse the xml
			try{
				Document doc = this.getDomElement(rss_feed_xml);
				NodeList nodeList = doc.getElementsByTagName(TAG_CHANNEL);
				Element e = (Element) nodeList.item(0);
				
				// Getting items array
				NodeList items = e.getElementsByTagName(TAG_ITEM);
				
				// looping through each item
				for(int i = 0; i < items.getLength(); i++){
					Element e1 = (Element) items.item(i);
					
					String title = this.getValue(e1, TAG_TITLE);
					String link = this.getValue(e1, TAG_LINK);
					String description = this.getValue(e1, TAG_DESRIPTION);
					String pubdate = this.getValue(e1, TAG_PUB_DATE);
					String guid = this.getValue(e1, TAG_GUID);
					
					RSSItem rssItem = new RSSItem(title, link, description, pubdate, guid);
					
					// adding item to list
					itemsList.add(rssItem);
				}
			}catch(Exception e){
				// Check log for errors
				e.printStackTrace();
			}
		}
		
		// return item list
		return itemsList;
	}

	/**
	 * Getting RSS feed link from HTML source code
	 * 
	 * @param ulr is url of the website
	 * @returns url of rss link of website
	 * */
	public String getRSSLinkFromURL(String url) {
		// RSS url
		String rss_url = null;

		try {
			// Using JSoup library to parse the html source code
			org.jsoup.nodes.Document doc = Jsoup.connect(url).get();
			// finding rss links which are having link[type=application/rss+xml]
			org.jsoup.select.Elements links = doc
					.select("link[type=application/rss+xml]");
			
			Log.d("No of RSS links found", " " + links.size());
			
			// check if urls found or not
			if (links.size() > 0) {
				rss_url = links.get(0).attr("href").toString();
			} else {
				// finding rss links which are having link[type=application/rss+xml]
				org.jsoup.select.Elements links1 = doc
						.select("link[type=application/atom+xml]");
				if(links1.size() > 0){
					rss_url = links1.get(0).attr("href").toString();	
				}
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}

		// returing RSS url
		return rss_url;
	}

	/**
	 * Method to get xml content from url HTTP Get request
	 * */
	public String getXmlFromUrl(String url) {
		String xml = null;

		try {
			// request method is GET
			DefaultHttpClient httpClient = new DefaultHttpClient();
			HttpGet httpGet = new HttpGet(url);

			HttpResponse httpResponse = httpClient.execute(httpGet);
			HttpEntity httpEntity = httpResponse.getEntity();
			xml = EntityUtils.toString(httpEntity);

		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		// return XML
		return xml;
	}

	/**
	 * Getting XML DOM element
	 * 
	 * @param XML string
	 * */
	public Document getDomElement(String xml) {
		Document doc = null;
		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
		try {

			DocumentBuilder db = dbf.newDocumentBuilder();

			InputSource is = new InputSource();
			is.setCharacterStream(new StringReader(xml));
			doc = (Document) db.parse(is);

		} catch (ParserConfigurationException e) {
			Log.e("Error: ", e.getMessage());
			return null;
		} catch (SAXException e) {
			Log.e("Error: ", e.getMessage());
			return null;
		} catch (IOException e) {
			Log.e("Error: ", e.getMessage());
			return null;
		}

		return doc;
	}

	/**
	 * Getting node value
	 * 
	 * @param elem element
	 */
	public final String getElementValue(Node elem) {
		Node child;
		if (elem != null) {
			if (elem.hasChildNodes()) {
				for (child = elem.getFirstChild(); child != null; child = child
						.getNextSibling()) {
					if (child.getNodeType() == Node.TEXT_NODE || ( child.getNodeType() == Node.CDATA_SECTION_NODE)) {
						return child.getNodeValue();
					}
				}
			}
		}
		return "";
	}

	/**
	 * Getting node value
	 * 
	 * @param Element node
	 * @param key  string
	 * */
	public String getValue(Element item, String str) {
		NodeList n = item.getElementsByTagName(str);
		return this.getElementValue(n.item(0));
	}
}

5. Writing SQLite Database Handler Class

In this application i am storing user entered websites in sqlite database. The basic website information like title, link, rss_link, description is stored in database. I created a table called websites with the following columns.

android rss parser sqlite

Create class called RSSDatabaseHandler.java in your project and type the following code. This class has following functions

public void addSite(WebSite site) {} // add a new row in websites table

public List<WebSite> getAllSites() {} //returns all the rows as Website class objects

public int updateSite(WebSite site) {} // update existing row

public WebSite getSite(int id) {} // returns single row

public void deleteSite(WebSite site) {} // deletes a single row

public boolean isSiteExists(String rss_link) {} //check if a website is already existed

RSSDatabaseHandler.java

package com.androidhive.rssreader;

import java.util.ArrayList;
import java.util.List;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class RSSDatabaseHandler extends SQLiteOpenHelper {

	// Database Version
	private static final int DATABASE_VERSION = 1;

	// Database Name
	private static final String DATABASE_NAME = "rssReader";

	// Contacts table name
	private static final String TABLE_RSS = "websites";

	// Contacts Table Columns names
	private static final String KEY_ID = "id";
	private static final String KEY_TITLE = "title";
	private static final String KEY_LINK = "link";
	private static final String KEY_RSS_LINK = "rss_link";
	private static final String KEY_DESCRIPTION = "description";

	public RSSDatabaseHandler(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	// Creating Tables
	@Override
	public void onCreate(SQLiteDatabase db) {
		String CREATE_RSS_TABLE = "CREATE TABLE " + TABLE_RSS + "(" + KEY_ID
				+ " INTEGER PRIMARY KEY," + KEY_TITLE + " TEXT," + KEY_LINK
				+ " TEXT," + KEY_RSS_LINK + " TEXT," + KEY_DESCRIPTION
				+ " TEXT" + ")";
		db.execSQL(CREATE_RSS_TABLE);
	}

	// Upgrading database
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// Drop older table if existed
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_RSS);

		// Create tables again
		onCreate(db);
	}

	/**
	 * Adding a new website in websites table Function will check if a site
	 * already existed in database. If existed will update the old one else
	 * creates a new row
	 * */
	public void addSite(WebSite site) {
		SQLiteDatabase db = this.getWritableDatabase();

		ContentValues values = new ContentValues();
		values.put(KEY_TITLE, site.getTitle()); // site title
		values.put(KEY_LINK, site.getLink()); // site url
		values.put(KEY_RSS_LINK, site.getRSSLink()); // rss link url
		values.put(KEY_DESCRIPTION, site.getDescription()); // site description

		// Check if row already existed in database
		if (!isSiteExists(db, site.getRSSLink())) {
			// site not existed, create a new row
			db.insert(TABLE_RSS, null, values);
			db.close();
		} else {
			// site already existed update the row
			updateSite(site);
			db.close();
		}
	}

	/**
	 * Reading all rows from database
	 * */
	public List<WebSite> getAllSites() {
		List<WebSite> siteList = new ArrayList<WebSite>();
		// Select All Query
		String selectQuery = "SELECT  * FROM " + TABLE_RSS
				+ " ORDER BY id DESC";

		SQLiteDatabase db = this.getReadableDatabase();
		Cursor cursor = db.rawQuery(selectQuery, null);

		// looping through all rows and adding to list
		if (cursor.moveToFirst()) {
			do {
				WebSite site = new WebSite();
				site.setId(Integer.parseInt(cursor.getString(0)));
				site.setTitle(cursor.getString(1));
				site.setLink(cursor.getString(2));
				site.setRSSLink(cursor.getString(3));
				site.setDescription(cursor.getString(4));
				// Adding contact to list
				siteList.add(site);
			} while (cursor.moveToNext());
		}
		cursor.close();
		db.close();

		// return contact list
		return siteList;
	}

	/**
	 * Updating a single row row will be identified by rss link
	 * */
	public int updateSite(WebSite site) {
		SQLiteDatabase db = this.getWritableDatabase();

		ContentValues values = new ContentValues();
		values.put(KEY_TITLE, site.getTitle());
		values.put(KEY_LINK, site.getLink());
		values.put(KEY_RSS_LINK, site.getRSSLink());
		values.put(KEY_DESCRIPTION, site.getDescription());

		// updating row return
		int update = db.update(TABLE_RSS, values, KEY_RSS_LINK + " = ?",
				new String[] { String.valueOf(site.getRSSLink()) });
		db.close();
		return update;

	}

	/**
	 * Reading a row (website) row is identified by row id
	 * */
	public WebSite getSite(int id) {
		SQLiteDatabase db = this.getReadableDatabase();

		Cursor cursor = db.query(TABLE_RSS, new String[] { KEY_ID, KEY_TITLE,
				KEY_LINK, KEY_RSS_LINK, KEY_DESCRIPTION }, KEY_ID + "=?",
				new String[] { String.valueOf(id) }, null, null, null, null);
		if (cursor != null)
			cursor.moveToFirst();

		WebSite site = new WebSite(cursor.getString(1), cursor.getString(2),
				cursor.getString(3), cursor.getString(4));

		site.setId(Integer.parseInt(cursor.getString(0)));
		site.setTitle(cursor.getString(1));
		site.setLink(cursor.getString(2));
		site.setRSSLink(cursor.getString(3));
		site.setDescription(cursor.getString(4));
		cursor.close();
		db.close();
		return site;
	}

	/**
	 * Deleting single row
	 * */
	public void deleteSite(WebSite site) {
		SQLiteDatabase db = this.getWritableDatabase();
		db.delete(TABLE_RSS, KEY_ID + " = ?",
				new String[] { String.valueOf(site.getId())});
		db.close();
	}

	/**
	 * Checking whether a site is already existed check is done by matching rss
	 * link
	 * */
	public boolean isSiteExists(SQLiteDatabase db, String rss_link) {

		Cursor cursor = db.rawQuery("SELECT 1 FROM " + TABLE_RSS
				+ " WHERE rss_link = '" + rss_link + "'", new String[] {});
		boolean exists = (cursor.getCount() > 0);
		return exists;
	}

}

In this part we completed building required classes for our application. In Android RSS Reader Application using SQLite Part 2 we can start with coding the application layouts and functioning.

This image is for thumbnail purpose
android rss reader application
Subscribe
Notify of
guest
71 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
trackback

[…] Android RSS Reader Application using SQLite Part 1 we completed creating required classes. In this part we are starting with designing the […]

trackback

[…] Android RSS Reader Application using SQLite Part 1 we completed creating required classes. In this part we are starting with designing the […]

Guest
Guest
7 years ago

hi ravi, there is a class called RSSFeed, when we create an object of that class in RSSParser class, its generally like

RSSFeed rssFeed=new RSSFeed();

can u please explain me this syntax in your RSSParser class

“public RSSFeed getRSSFeed(String url) {}”

but sir im not getting the syntax used.. can anyone guide me please. what does getRSSFeed represent? there are no methods like this throughout the program

Sheron
Sheron
7 years ago

john you are right, not all the urls load with the current condition, but when i remove that condition the application gives a force close error, did u come across that error, if yes could u please share a solution for this.

Sheron
Sheron
7 years ago

Great tutorial, thanks a bunch, but it does not recognize the rss from all the links that i enter, out of 10 i would say it recognizes only around 1 or 2, could you please tell why this happens and a possible solution to it, even famous sites like lifehacker, ABC , cnn are not recognized.
thanks

Scally
Scally
6 years ago

Hi Ravi, just went through this great tutorial but i am having an error at this line org.jsoup.nodes.Document doc = Jsoup.connect(url).get();
i have tried most of the solutions discussed above, but i am still not getting it
would really appreciate if you could help me

Scally
Scally
6 years ago

Hi its me again. I just wanted to add that in your video the app was working fine………… so maybe you made some corrections to the above code…….but forgot to update it.
If so, KINDLY please let me know how to go about it.

george
george
6 years ago

Hi all. I am a novice in developing app and thanks to
Ravi for all good work that is doing . I’m working at a simple app and I get
stuck . if you have knowledge of
building android apps, and make team
with me please replay to george.celsie@gmail.com . Thanks and good luck to all. Thancks

Rizwan Babar
Rizwan Babar
6 years ago

i need some help on adding twitter ,facebook,gmail etc feeds together and also if 1 post something it will post on all

Priya Patel
Priya Patel
6 years ago

Hi Ravi Sir,

Thanks for Tutorial.

Most of RSS feed can’t added . “it’s giving msg like Rss url not found Please check th url”

RSS feed like

1. http://www.ndtv.com

2. http://www.hindustantimes.com

3. http://www.Bhaskar.com

4. http://www.zeenews.india.com

5. http://www.ibnlive.in.com

and many more ….
Dear Ravi sir Pls help me as par as possible

Parsh
Parsh
6 years ago
Reply to  Priya Patel

for hindustan times rss feed url go and get it here for what category you want “http://www.hindustantimes.com/RSSFeed/RSSSubSectionPage.aspx”
and for ndtv go here “http://www.ndtv.com/rss”
etc
for all those websites go to those website you will find a rss feeder icon click on that, there you’ll see rss feeder URL

Vivek
4 years ago
Reply to  Priya Patel

Update the complete rss url 🙂 like http://the247tech.com/feed/ or ndtv.com/rss/

Mohammad Parvez
Mohammad Parvez
6 years ago

hello ravi i downloaded you project it is working also but for some url it is not taking can you give me the list of urls that will open in our app plz i have exam

lovely
lovely
6 years ago

i downloaded the code but its not running in my system.
it shows the first activity where we are adding new site but on adding it says “unfortunately failed “.
What to do in this case?

Segun
Segun
6 years ago

Hello..please how do you package this to an android application that can be installed thanks

Ravi Tamada
6 years ago
Reply to  Segun

If you successfully run the app, you can find the .apk in projects bin folder.

Neha
Neha
6 years ago

When Adding new site unfortunately failed message is coming please help

arpit
arpit
6 years ago

hii sir, how can we add instagram feed of a particular instagram account such that we can see the update and what ever is posted

Nasif Ahmed
Nasif Ahmed
5 years ago

I cant download code. It says “This webpage is not available”. Now i downloaded it.

manvi
manvi
5 years ago

when i enter the url it gives error …….application close .. plz plz plz help me its very urgent

Eman Alsabbagh
Eman Alsabbagh
5 years ago
Reply to  manvi

Yes, with me too. all tried urls are gives error

constantinembufung
constantinembufung
5 years ago

Rss url not found. Please check url or try again.

Sara Qasim
Sara Qasim
4 years ago

hey. I want my Rss feed Application to only fetch a particular title news.
i have used this but cant figure out how can i apply filter on it… please help:

private List readFeed(XmlPullParser parser) throws XmlPullParserException, IOException {
parser.require(XmlPullParser.START_TAG, null, “rss”);
String title = null;
String link = null;
List items = new ArrayList();
while (parser.next() != XmlPullParser.END_DOCUMENT) {
if (parser.getEventType() != XmlPullParser.START_TAG) {
continue;
}
String name = parser.getName();
if (name.equals(“title”)) {
title = readTitle(parser);
} else if (name.equals(“link”)) {
link = readLink(parser);
}
if (title != null && link != null) {
RssItem item = new RssItem(title, link);
items.add(item);
title = null;
link = null;
}
}
return items;
}

private String readLink(XmlPullParser parser) throws XmlPullParserException, IOException {
parser.require(XmlPullParser.START_TAG, ns, “link”);
String link = readText(parser);
parser.require(XmlPullParser.END_TAG, ns, “link”);
return link;
}

private String readTitle(XmlPullParser parser) throws XmlPullParserException, IOException {
parser.require(XmlPullParser.START_TAG, ns, “title”);
String title = readText(parser);
parser.require(XmlPullParser.END_TAG, ns, “title”);
return title;

Pratheesh Premnath
Pratheesh Premnath
3 years ago

Hi Ravi Tamada, Like always this is also a superb tutorial. This works fine for me. I have a doubt to show feeds from google alerts. It needs a valid email address to show the feeds. How can we integrate that with this program?? Thanks in advance.

Ravi Tamada
3 years ago

May be you can integrate Google Plus Login to get the valid email id from user.
http://www.androidhive.info/2014/02/android-login-with-google-plus-account-1/

Pratheesh Premnath
Pratheesh Premnath
3 years ago
Reply to  Ravi Tamada

Thanks Ravi Tamada. Will try it out.

Fahmy
Fahmy
3 years ago

Thanks for tutorial 👍🏻

Ravi Tamada
3 years ago
Reply to  Fahmy

You are welcome 🙂

Mayank Langalia
Mayank Langalia
3 years ago

Is it possible to get google news RSS feed in your application ? If yes please share google news URL
Google is RSS+XML or ATOM+XML ?

Kimfai108
Kimfai108
8 years ago

HI Ravi, can i send private email to ask you?

Pratama Nur Wijaya
8 years ago

good one sir..

Ravi Tamada
8 years ago

Thank You and you blog is good.

Ali
Ali
8 years ago

you are the best Mr.Tamada…keep it up

Edward James Woollard
Edward James Woollard
8 years ago
Reply to  Ali

Ali, please can you assist me in how you managed to get the RSS Reader to work for one website only? Thank you!

Ali
Ali
8 years ago

I have got a question for you if you don’t mind answer it…
how can I set default rss links?

Ravi Tamada
8 years ago
Reply to  Ali

What do u mean by default rss?

If you mean you want to use single rss link in entire application, you have hard code it in Main Activity file.

Ali
Ali
8 years ago
Reply to  Ravi Tamada

yes this what I mean. I have been trying to do so,, but I failed because I’m new to Android development 🙁
could you tell me how, please?

Ravi Tamada
8 years ago
Reply to  Ali

For this you don’t need other activities. Set ListRSSItemsActivity.java as your main activity (first screen) and in the code onCreate method pass your rss link to background thread. Also you can remove the code above this line.

new loadRSSFeedItems().execute(“your rss link here”);

Edward James Woollard
Edward James Woollard
8 years ago
Reply to  Ravi Tamada

Nice job on the website, I ended up tabbing nearly every tutorial because they were all such relevant stuff, keep it going!

nook3nook
nook3nook
8 years ago

I follow you but I can’t work

and Add url “” I can’t work

I don’t know why “” I use your code.

Han
Han
8 years ago

Hello dear Ravi, i downloaded your code and did the properties to run with jsoup-1.6.2.jar file. There was no error in my eclipse. I ran it and when i was entering http://androidhive.info it forced closed the application ;( what did i do wrong?

Han
Han
8 years ago
Reply to  Han

i tried other website, resulted with the same error result

nook3nook
nook3nook
8 years ago
Reply to  Han

jsoup-1.6.2.jar is in file AndroidRssReaderApplication

You can add

Abdelrahman Serag
8 years ago
Reply to  nook3nook

it doesn’t work after adding the jar neither before !!! 🙁
any help

Kapil Kapri
Kapil Kapri
7 years ago
Reply to  Han

Make a libs folder to the root application folder(AndroidRSSReaderApplication) paste the jsoup-1.6.2.jar to it.

Right click on project–>properties–>

1)libraries–>add jars–>(browse your libs folder )

2)Order and Export –> check the Android Private Libraries

clean your project and run

Shekhar
Shekhar
8 years ago

how to read twitter feeds??

Sabiha1411
Sabiha1411
8 years ago

can i use api 7 in this project???

Achref
Achref
8 years ago

salut Ravi merci beaucoup pour ce tuto.j’ai une erreur lorsque j’entre un url d’un site =>forced closed the application.est ce que vous avez un idée de quoi il s’agit??

Ravi Tamada
8 years ago
Reply to  Achref

vérifier que votre chat log pour les erreurs

Achref
Achref
8 years ago
Reply to  Ravi Tamada

Bonjour,et comment faire ça car je suis débutant dans la programmation android.merci.

Ravi Tamada
8 years ago
Reply to  Achref

Vous pouvez ouvrir votre chat log d’Eclipse -> Windows -> Show View -> Autres -> Android – cat> Journal. Cat Open log ouvert exécuter le projet et vérifier s’il ya des erreurs.

Achref
Achref
8 years ago
Reply to  Ravi Tamada

il y a beaucoup d’erreur parmi il y a dans la classe rss parser le lien que j’ai entrer http://thd.tn

Ravi Tamada
8 years ago
Reply to  Achref

envoyez-moi des captures d’écran si possible à ravi8x@gmail.com

Achref
Achref
8 years ago
Reply to  Ravi Tamada

c’est fait 😉

Achref
Achref
8 years ago
Reply to  Achref

Ravi aparament il faut changer la structure du rss document channel tag il faut que les balises soient compatibles avec la structure du site je vais le tester et je te dis si il y a de nouveau

Ply
Ply
8 years ago

Great tutorial ! I have any question if I want to show listview from myql what should I do? Can you advice?

Thank

Ply
Ply
8 years ago
Reply to  Ravi Tamada

Thank you for good tutorial

John Wiley
John Wiley
8 years ago

Great tutorial. But, I have found that most feeds do not include the “[type=application/rss+xml]”, so most feeds fail. Take this verification out and you can put most feeds in your list.

Psyvegas
Psyvegas
7 years ago
Reply to  John Wiley

John, what would be the alternate solution to resolve the problem? could you share more detail with us?

John Wiley
John Wiley
7 years ago
Reply to  Psyvegas

I’m not sure but most rss feeds no longer have type=application/rss+xml in them, so this app is failing most of the time. To verify it is an rss feed, maybe you could just check for “rss version=” or something. I just took that whole check out of it and made sure I typed in valid url’s.

John Wiley
John Wiley
8 years ago

This tutorial only parses text data (CDATA). How can I modify it to grab images (media:content). I think the Images use type attribute instead of type CDATA. I’m stuck on how to parse both types.

Lisa Sigita
Lisa Sigita
8 years ago

many thanks. finally I could find great resources. thanks for your hardwork

Nicola Brogelli
Nicola Brogelli
8 years ago

When I try to enter a url I generate an error at this point
rssParser.getRSSFeed (url);
What can I do to correct the error?
hello and thank you

Psyvegas
Psyvegas
7 years ago

Ravi,

I’m trying to enter URL ex (http://www.dotnetnuke.com/Resources/Blogs/rssid/99.aspx) but it won’t take the URL. Do you have any idea what could be the issue please? I tested the URL on an iPhone RSS Reader and it works fine.

Diogo Ferreira
Diogo Ferreira
7 years ago

Great tutorial. But i´m trying to run this project and the aplication stopped (the aplication stopped unexpectedly), and I don´t know why what is the reason. I don´t have any error in my project but it isn´t work :s have you any idea about the problem?

Kapil Kapri
Kapil Kapri
7 years ago
Reply to  Diogo Ferreira

The prblm is your app is not getting the jsoup properly

try this its wrk for me..

Make a libs folder to the root application folder(AndroidRSSReaderApplication) paste the jsoup-1.6.2.jar to it.

Right click on project–>properties–>

1)libraries–>add jars–>(browse your libs folder )

2)Order and Export –> check the Android Private Libraries

clean your project and run

Charlie Drolshagen
Charlie Drolshagen
7 years ago

Fantastic tutorial! Exactly what I was looking for!

khaironi
khaironi
7 years ago

i had download this code ,,but i have found error while input RSS ,what wrong..?
this logcat show fatal exception: Asyntask #2

please help me ,..

pskjobs
pskjobs
7 years ago

how can i do this with xml i need it for my website : http://www.pskjobs.com

abdullah
abdullah
7 years ago

does any difference between RSS parser and XML parser? Can I parse RSS with your Android XML Parsing Tutorial? Thx for tutorials.

71
0
Would love your thoughts, please comment.x
()
x